The Insertion Sort can be viewed as simulating the sorting of playing cards in a person's hand. Moving from left to right, each card is examined in turn. If it is lower than any of the cards to its left, the appropriate space is opened and the card is inserted.
The Source | The Variables |
1   2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 NEXT | |
The Output | |
The Source The array is passed as a variable parameter (since it is likely to be altered) and the number of elements is passed as a value parameter. | |