The Sorter
3:32
Added: 4 years ago
From: mlittman
Views: 44,954
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:

All Comments (55)

Sign In or Sign Up now to post a comment!
  • .. but for me it´s n*log(n) !

  • This song became the anthem of our CS department lol

  • You forgot about mergesort?

  • I loved it!

  • I am just putting it on my ipod, can I?

  • Im so using this for teaching the new students next semester ^^

  • great! let me know how it works out. (if you practice, you can even sort cards that way.)

  • @mlittman

    Actually , our assistant professor showed us this video :D

    And it worked out fine , for me!

  • I like this song!

  • this is an intersting way 2 explain

  • Comment removed

  • thanks! (who was the prof? UIUC is a great school!)

  • Comment removed

  • awesome

  • this is awesome!!

  • Awesome Video!

  • epic!

  • and i thought i was a nerd 0.o

  • Don't worry, you are.

  • wow -_-

    smart guy 'eh?

  • cringe

  • O_o

  • wow! i loved that music... awesome!

  • That's pretty awesome, gg vid lol.

  • yyuyu

  • xDDDDDDDDD thanks a lot xD

  • Es como el plaza sesamo de la progrmacion

  • Gracias!

  • GENIAL!!!

  • oui :) je suis d'accord

  • Isn't n times through a list linear rather than quadratic?

  • searching through a list of length n is linear (n). Repeating that operations n times is quadratic (n times n = n squared).

  • SOLID! I WANT MORE!

  • great!!!! just great! wish if they could teach us like that at college

  • a dell made in texas lol i love it. learning this night before midterm. way better than reading books

  • god thats cheesy, informative, but cheesy...

  • this is awesome! I like the original version but this is ace.

  • thats hilarious

  • man that was funny :)

  • dude... that was fun ... :)

    but yeah i'd rather use heapsort... which i can count on... no worst case scenario...!

  • well, with the heap sort, if your list is already sorted, the algorithm do not detect it and mix up the list to build the heap. In my opinion, it's very bad.

    We can improve quicksort speed by using the insertion sort algorithm to sort less than 7 items, rather than continuing by choosing a pivot and etc.

  • Awesome ! :P i learnt quick sort instantly lolz

  • So awesome.

  • Firstly,excellent fun breakdown of the 2 sorts.

  • Secondly, in ur QuickSort, choosing a good middle value pivot by random to reduce the number of swaps&compares has some luckyness to it.Recursively do the following.

  • There's a technique called median of 3 that's sorts asc/dsc the middle,start and end index values to obtain a better middle value

  • L&L: Thanks for the informative comments. Yes, I realize there is more to sorting than I covered in that song! In my class, I do touch on some of the other sorts, although I don't go into depth about effective ways to choose pivots (it's not that kind of class). As for shell sort, I always thought it was n x sqrt(n), but wikipedia says it can be made n log^2 n. I don't know how that analysis goes, though.

  • When you program the QuickSort a common method is simple choose the right most index as the pivot. However, if the set is in ascending or decending order and the sort does the vice sort of this, then this can degrade the QuickSort to O(N^2). Precautions such as knowing the set will be random or using the median of 3 will prevent this.

  • If one suggestedto writing/using a random generator to choose each pivot,this would certainly slow the Quicksort, due to all the computation overheads in this.

    (As a wild say, use slow sorts( O(N)^2 )ones on fewer than 1000 items, Advanced Sorts on anything greater.) Though Moores Law and computation speed is everly increasing and slow sorts are getting seemingly less slow.

  • If the data isn't random, such as Quicksort Ascending a roughly Decending Set, then a HeapSort is better, or Radix, or MergeSort could possible but the 2 later use more memory also all can be conceptually harder to understand but each are O(N*logN), but these sorts O(N*logN) are minutly slower, then an a QuickSort at (N*logN) best.

  • Minute diffrence meaning more comparisons, also, if MergeSort is implemented using Recursion also create minor speed diffrences. But as I said better than QuickSort during its Worst Case Scenario.

  • mlittman for introclasses it will be good to teach basic sorts such as, bubble sort, selection sort then insertion sort. If you fancy squeezing an advance sort, try the Shell sort, as its an clever expansion of Insertion Sort with nice visualisation of its working. Also, its Order(n*logn)^2 slower than QSort.

  • OmfG THys Is SO0O0OOOoO gHEY.

  • ehauheiheauhaea, =), very good...

  • No, quicksort is bad! Its worst case is quadratic O(n²). Introsort and Mergesort are better than both. All my professors discourage quicksort greatly.

  • I hadn't heard of introsort, but the wikipedia entry seems misleading. Quicksort with a random pivot is expected n log n and the chance of being Omega(n^2) is exponentially small (facts not even mentioned on the page). Quicksort is fast and lightweight and an astonishing improvement over selection sort. One can engineer it to squeeze as much performance out of it as possible, but that's not really a topic for an intro class.

  • indeed it is lol. poor selection

  • holy mother of jesus, thats hilarious!

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