Added: 3 years ago
From: Psyjo
Views: 26,227
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:
see all

All Comments (16)

Sign In or Sign Up now to post a comment!
  • @blauhuden111

    I just wrote a quicksort, it is extremely easy to avoid O(n^2) perf on presorted, or reverse sorted arrays.

    Only the most naive implementations will behave that way.

    Also, memory usage should be controlled by using a stack to eliminate recursion overhead and modifying the algorithm to be an in place sort instead of using 2 separate arrays for the high and low values.

    You are correct that the basic recursive quicksort algorithm will behave badly in this case though.

  • this animation is cool^^

  • quicksort sucks if the data is already close to being sorted... and it uses loads of memory.

  • @T0B0KKE rofl.

  • @spechtbert It's the truth.

  • @T0B0KKE sure.

  • @spechtbert No really, quicksort uses a lot of memory when fed a fully-sorted or mostly-sorted array. Look it up. quicksort has a O(n^2) if it's sorting a presorted array.

  • If you want interesting sorts, look into Smoothsort.

  • is the other sort tweeked selection sort ??? far more interesting than selection... still Quick is quick for the quicksort :P

  • @putzmitt3l It looks to me like its a kind of bubble sort, only it goes is two directions.

  • @dented42 Yes. Shakersort is bidirectional bubblesort.

  • Quicksort's quick, yeah yeah yeah!

  • @Mank25 fuck off ive invented a sort quicker than quicksort but im gonna release it after my patent has been processed my new way to sort is gonna change the world wait and see

  • @Mank25 It's not slow,no no no!

  • @BushHatesMe I love replying to 2 year old comments too!

  • nice;)

Loading...
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