Created
April 2, 2014 17:32
-
-
Save manonthemat/9938961 to your computer and use it in GitHub Desktop.
Example of a simple algorithm with a running time that grows proportional to the input size
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
def find_max(data): | |
"""Return the maximum element from a nonempty Python list.""" | |
biggest = data[0] | |
for val in data: | |
if val > biggest: | |
biggest = val | |
return biggest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment