some simple algorithms and data structures to the thing initially sought this is what happens each time we use variable to refer to the object to which that variable is bound when we use variable to access list and then reference stored in that list to access another objectwe are going through two levels of indirection binary search and exploiting assumptions getting back to the problem of implementing search(le)is (len( )the best we can doyesif we know nothing about the relationship of the values of the elements in the list and the order in which they are stored in the worst casewe have to look at each element in to determine whether contains but suppose we know something about the order in which elements are storede suppose we know that we have list of integers stored in ascending order we could change the implementation so that the search stops when it reaches number larger than the number for which it is searchingdef search(le)"""assumes is listthe elements of which are in ascending order returns true if is in and false otherwise""for in range(len( ))if [ =ereturn true if [iereturn false return false this would improve the average running time howeverit would not change the worst-case complexity of the algorithmsince in the worst case each element of is examined we canhoweverget considerable improvement in the worst-case complexity by using an algorithmbinary searchthat is similar to the bisection search algorithm used in to find an approximation to the square root of floating point number there we relied upon the fact that there is an intrinsic total ordering on floating point numbers here we rely on the assumption that the list is ordered the idea is simple pick an indexithat divides the list roughly in half ask if [ = if notask whether [iis larger or smaller than depending upon the answersearch either the left or right half of for it has often been said that "any problem in computing can be solved by adding another level of indirection following three levels of indirectionwe attribute this observation to david wheeler the paper "authentication in distributed systemstheory and practice,by butler lampson et al contains the observation it also contains footnote saying that "roger needham attributes this observation to david wheeler of cambridge university