Created
November 10, 2020 01:57
-
-
Save rothhound/72849e1f94eeb7fb7155517316ff206a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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