# Important algorithms to know: # Binary Search def binsearch(x,A): # A must be sorted in increasing order answer = False min,max = 0,len(A)-1 while answer==False and min<=max: mid = (min+max)//2 if A[mid]==x: answer = True elif A[mid]>x: max = mid-1 else: min = mid+1 #while return answer #binsearch # swapsort: sort list A (in increasing order) by swaping the ith smallest # value to A[i]. def swapsort(A): i = 0 while i<=len(A)-2: # find index of smallest value starting at index i: si = i # index of smallest k = i+1 while k<=len(A)-1: if A[k]