67
Big O notation revisited
Merge sort vs. quicksort
Suppose you have this simple function to print every item in a list:
def print_items(list):
for item in list:
print item
This function goes through every item in the list and prints it out.
Because it loops over the whole list once, this function runs in O(
n
)
time. Now, suppose you change this function so it sleeps for 1 second
before it prints out an item:
Dostları ilə paylaş: