One basic algorithm for sorting is the Simple Sort. We can illustrate this algorithm using a group of unsorted playing cards. The Simple Sort sort works by selecting the smallest card in the unsorted hand and moving this card to a second hand. Once all the cards have been removed from the unsorted hand, the second hand contains the cards in sorted order. The algorithm for the Simple Sort is given below:
Most of the steps in this algorithm are simple, but the third step needs a little more explanation. In order to be certain that we are selecting the smallest card, we need to compare all the cards in our hand. We can do this by comparing the first two cards and keeping the smaller of the two. Then we can compare this card to the remaining cards until we find a smaller one or check all the cards.