Un Shuffle Sort - Phase I - Distribution Phase

Distribution Phase

  1. Take the first input item and create pile#1 with item#1 as head and tail.
  2. If no more items goto Phase II.
  3. Take next input item.
  4. Select the last pile for comparison.
  5. Compare to top of the pile.
  6. If equal place on top of pile, goto 2.
  7. If less and this pile is not the first pile then select the previous pile for comparison, go to 5.
  8. If less and this pile is the first pile, place item on top of the pile, goto 2.
  9. If greater and this is not the last pile place on top of the next pile (which is the one previously compared), goto 2, else this Item is greater than top of last pile. Continue to 10.
  10. Compare to bottom of the current pile.
  11. If equal place on bottom of pile, goto 2.
  12. If greater and this is not the first pile select the previous pile, goto 10.
  13. If less and this is the last pile create a new pile with the item and append to the list of piles, goto 2.
  14. Place on bottom of the next pile (which is the one previously compared), goto 2.

Read more about this topic:  Un Shuffle Sort, Phase I

Famous quotes containing the words distribution and/or phase:

    The man who pretends that the distribution of income in this country reflects the distribution of ability or character is an ignoramus. The man who says that it could by any possible political device be made to do so is an unpractical visionary. But the man who says that it ought to do so is something worse than an ignoramous and more disastrous than a visionary: he is, in the profoundest Scriptural sense of the word, a fool.
    George Bernard Shaw (1856–1950)

    It no longer makes sense to speak of “feeding problems” or “sleep problems” or “negative behavior” is if they were distinct categories, but to speak of “problems of development” and to search for the meaning of feeding and sleep disturbances or behavior disorders in the developmental phase which has produced them.
    Selma H. Fraiberg (20th century)