from random import shuffle def locate(x, quarry): for item in x: if item == quarry: return True return False # if x has n elements, the use of resources here... O(n) #at most proportional to n. #memory and time are your computer's resurces. # unit of computational effort is the second byte def is_in_order(x): #x is a list. Return True iff x is an ascending order. y = x[0] for i in x: if i < y: return False y = i return True x = [1,4,2] print(is_in_order(x)) x = [1,2,3,4] print(is_in_order(x)) # what's the O of this? #O(n) def bozo(x): #shuffle x, see if it's in order. #if it is you are done. Otherwise, repeat. pass