Of course, we all know that the Simple Card Sort algorithm is not very useful to a computer. However, we can use the same idea as in our Simple Card Sort to write a Simple Sort that can be used by a computer. Let's see what this algorithm looks like and how it can be used to sort numbers in a computer.
|
|
Notice that most of the steps in our new algorithm are the same as the steps in the Simple Card Sort. The exception is step 6. We need this extra step because we are no longer moving cards from hand to hand but copying numbers in computer memory. For our algorithm to work, we must replace our original number with a special marker so it will not be considered again. The steps below illustrate how the Simple Sort algorithm works on a computer.
![]()
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() Unsorted Array ![]() ![]() ![]() ![]() ![]() ![]() ![]() Sorted Array |
![]() ![]() ![]() ![]() ![]() ![]() ![]() Unsorted Array ![]() ![]() ![]() ![]() ![]() ![]() ![]() Sorted Array |
![]() ![]() ![]() ![]() ![]() ![]() ![]() Unsorted Array ![]() ![]() ![]() ![]() ![]() ![]() ![]() Sorted Array |
![]() ![]() ![]() ![]() ![]() ![]() ![]() Unsorted Array ![]() ![]() ![]() ![]() ![]() ![]() ![]() Sorted Array |
![]() ![]() ![]() ![]() ![]() ![]() ![]() Unsorted Array ![]() ![]() ![]() ![]() ![]() ![]() ![]() Sorted Array |