P19 help?
P19 Extra Practice Problems:
#1 - find the index of a value in a list, or -1 if it’s not there
def find(v, lst):
""" 1. Return the index of the first occurrence of v in lst.
Return -1 if v is not in the list. Precondition: lst is a list. """
#4 - same as above, but:
def binary_search(v, sorted_lst):
""" Return the index of the first occurrence of v in lst. Return
-1 if v is not in the list. Precondition: lst is a list of things that
can be compared with the < operator, and is in sorted order
(i.e. lst[i] <= lst[i+1] for all i in range(len(lst)-1) """
P20 setup - design your own sorting algorithm!