Skip to content

Instantly share code, notes, and snippets.

@rothhound
Created November 10, 2020 01:57
Show Gist options
  • Save rothhound/72849e1f94eeb7fb7155517316ff206a to your computer and use it in GitHub Desktop.
Save rothhound/72849e1f94eeb7fb7155517316ff206a to your computer and use it in GitHub Desktop.
NUMBER_LIST = (1...9999999).to_a.shuffle
def linear_search(array, number)
array.each do |array_element|
return true if array_element == number
end
end
linear_search(NUMBER_LIST, 999324)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment