Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Example of a simple algorithm with a running time that grows proportional to the input size
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