Strand Sort - Example

Example

Unsorted list Sublist Sorted list
3 1 5 4 2
1 4 2 3 5
1 4 2 3 5
2 1 4 3 5
2 1 3 4 5
2 1 3 4 5
1 2 3 4 5
  1. Parse the unsorted list once, taking out any ascending (sorted) numbers.
  2. The (sorted) sublist is, for the first iteration, pushed onto the empty sorted list.
  3. Parse the unsorted list again, again taking out relatively sorted numbers.
  4. Since the sorted list is now populated, merge the sublist into the sorted list.
  5. Repeat steps 3–4 until both the unsorted list and sublist are empty.

Read more about this topic:  Strand Sort

Famous quotes containing the word example:

    Our intellect is not the most subtle, the most powerful, the most appropriate, instrument for revealing the truth. It is life that, little by little, example by example, permits us to see that what is most important to our heart, or to our mind, is learned not by reasoning but through other agencies. Then it is that the intellect, observing their superiority, abdicates its control to them upon reasoned grounds and agrees to become their collaborator and lackey.
    Marcel Proust (1871–1922)