searching and sorting listing implementation of the linear search on sorted sequence def sortedlinearsearchthevaluesitem lenthevalues for in rangen if the target is found in the ith elementreturn true if thevalues[ =item return true if target is larger than the ith elementit' not in the sequence elif thevalues[iitem return false return false the item is not in the sequence finding the smallest value instead of searching for specific value in an unsorted sequencesuppose we wanted to search for the smallest valuewhich is equivalent to applying python' min(function to the sequence linear search is performed as beforebut this time we must keep track of the smallest value found for each iteration through the loopas illustrated in listing to prime the loopwe assume the first value in the sequence is the smallest and start the comparisons at the second item since the smallest value can occur anywhere in the sequencewe must always perform complete traversalresulting in worst case time of (nlisting searching for the smallest value in an unsorted sequence def findsmallestthevalues ) lenthevalues assume the first item is the smallest value smallest thevalues[ determine if any other item in the sequence is smaller for in range if thelist[ismallest smallest thevalues[ireturn smallest return the smallest found the binary search the linear search algorithm for sorted sequence produced slight improvement over the linear search with an unsorted sequencebut both have linear timecomplexity in the worst case to improve the search time for sorted sequencewe can modify the search technique itself consider an example where you are given stack of examswhich are in alphabetical orderand are asked to find the exam for "jessica roberts in performing