# Author: Scott Wehrwein
# Date: 3/6/23
# An implementation of binary search


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. """    
    for i, val in enumerate(lst):
        if val == v:
            return i
    return -1


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) """
    