searching and sorting saw earlier in the the efficiency of some applications can be improved when working with sorted lists another common use of sorting is for the presentation of data in some organized fashion for examplewe may want to sort class roster by student namesort list of cities by zip code or populationrank order sat scoresor list entries on bank statement by date sorting is one of the most studied problems in computer science and extensive research has been done in this arearesulting in many different algorithms while python provides sort(method for sorting listit cannot be used with an array or other data structures in additionexploring the techniques used by some of the sorting algorithms for improving the efficiency of the sort problem may provide ideas that can be used with other types of problems in this sectionwe present three basic sorting algorithmsall of which can be applied to data stored in mutable sequence such as an array or list bubble sort simple solution to the sorting problem is the bubble sort algorithmwhich rearranges the values by iterating over the list multiple timescausing larger values to bubble to the top or end of the list to illustrate how the bubble sort algorithm workssuppose we have four playing cards (all of the same suitthat we want to order from smallest to largest face value we start by laying the cards out face up on table as shown here the algorithm requires multiple passes over the cardswith each pass starting at the first card and ending one card earlier than on the previous iteration during each passthe cards in the first and second positions are compared if the first is larger than the secondthe two cards are swapped nextthe cards in positions two and three are compared if the first one is larger than the secondthey are swapped otherwisewe leave them as they were this process continues for each successive pair of cards until the card with the largest face value is positioned at the end