we pick up the and add it to proper sorted positionwhich will be on the right side since there are no cards with smaller face value left on the table cards on the table our hand this process is continued until all of the cards have been picked up and placed in our hand in the correct sorted order from smallest to largest pick up the next smallest card ( pick up the next smallest card ( pickup the last card ( the resulting hand the process we used to sort the set of five cards is similar to the approach used by the selection sort algorithm but when implementing insertion sort in codethe algorithm maintains both the sorted and unsorted values within the same sequence structure the selection sortwhich improves on the bubble sortmakes multiple passes over the sequencebut unlike the bubble sortit only makes single swap after each pass the implementation of the selection sort algorithm is provided in listing listing implementation of the selection sort algorithm sorts sequence in ascending order using the selection sort algorithm def selectionsorttheseq ) lentheseq for in rangen )assume the ith element is the smallest smallndx determine if any other element contains smaller value for in rangei )if theseq[jtheseq[smallndxsmallndx swap the ith value and smallndx value only if the smallest value is not already in its proper position some implementations omit testing the condition and always swap the two values if smallndx ! tmp theseq[itheseq[itheseq[smallndxtheseq[smallndxtmp