case best case worst case average case item is present item is not present table comparisons used in sequential search of an unordered list figure sequential search of an ordered list of integers list in other wordsthe probability that the item we are looking for is in any particular position is exactly the same for each position of the list if the item is not in the listthe only way to know it is to compare it against every item present if there are itemsthen the sequential search requires comparisons to discover that the item is not there in the case where the item is in the listthe analysis is not so straightforward there are actually three different scenarios that can occur in the best case we will find the item in the first place we lookat the beginning of the list we will need only one comparison in the worst casewe will not discover the item until the very last comparisonthe nth comparison what about the average caseon averagewe will find the item about halfway into the listthat iswe will compare against items recallhoweverthat as gets largethe coefficientsno matter what they arebecome insignificant in our approximationso the complexity of the sequential searchis (ntable summarizes these results we assumed earlier that the items in our collection had been randomly placed so that there is no relative order between the items what would happen to the sequential search if the items were ordered in some waywould we be able to gain any efficiency in our search techniqueassume that the list of items was constructed so that the items were in ascending orderfrom low to high if the item we are looking for is present in the listthe chance of it being in any one of the positions is still the same as before we will still have the same number of comparisons to find the item howeverif the item is not present there is slight advantage figure shows this process as the algorithm looks for the item notice that items are still compared in sequence until at this pointhoweverwe know something extra not only is not the item we are looking forbut no other elements beyond can work either since the list is sorted in this casethe algorithm does not have to continue looking through all of the items to report that the item was not found it can stop immediately def ordered_sequential_search(a_listitem)pos found false stop false while pos len(a_listand not found and not stopif a_list[pos=itemfound true else searching