Since we will be manipulating the data sets in an array, we will have to compare all of the values of the data and move them once the ordering relationship between two values are determined. Below is the pseudo-code of the algorithm.
[font="Verdana, Tahoma, Arial"][size="2"]
[font="Courier New, fixedsys"][size="2"][color="#000088"] [/color][/font][/font]
Insertion Sort (Sorting the array A[size])
For index i = 2 up to i = size
{
While before reach the end of cells
{
Compare the element Awith the preceding element (A[i - 1]).
If the element is smaller than the preceding one (A < A[i - 1]),
swap them;
else, go to the next element.
}
}
[font="Courier New, fixedsys"][size="2"][color="#000088"] [/color][/font][/font]