Added: 3 years ago
From: kinkydarkbird
Views: 4,732
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:

All Comments (3)

Sign In or Sign Up now to post a comment!
  • Hows does it work when the elements aren't evenly spaced, i.e. with gaps?

  • @Pureferret That's no problem. This is just bubblesort going both ways. It starts by taking the first non-sorted element and as it progresses it checks to see if it can find a element that's bigger than the reference. If it does it switches to use the new largest element as reference. Once it reaches the end it has found the next element and therefore marks it as sorted. Going back is the same thing except it tries to find the smallest non-sorted element.

  • @SilkSwe So it just picks an element, check it against all unsorted elements and then swaps things around? makes sense :)

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more