Skip to content

Instantly share code, notes, and snippets.

@luizcarvalho
Created October 17, 2008 01:48
Show Gist options
  • Save luizcarvalho/17330 to your computer and use it in GitHub Desktop.
Save luizcarvalho/17330 to your computer and use it in GitHub Desktop.
class BuscaSeq
def initialize
end
def busca_sequencial(vetor,elemento)
@result = {:pos=>0,:iter=>0, :valor=>elemento}
vetor.each do |el|
@result[:iter]+=1
el == elemento ? (return @result) : @result[:pos]+=1
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment