Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Education Math Idle Science

The World of YouTube Bubble Sort Algorithm Dancing 68

theodp writes In addition to The Ghost of Steve Jobs, The Codecracker, a remix of 'The Nutcracker' performed by Silicon Valley's all-girl Castilleja School during Computer Science Education Week earlier this month featured a Bubble Sort Dance. Bubble Sort dancing, it turns out, is more popular than one might imagine. Search YouTube, for example, and you'll find students from the University of Rochester to Osmania University dancing to sort algorithms. Are you a fan of Hungarian folk-dancing? Well there's a very professionally-done Bubble Sort Dance for you! Indeed, well-meaning CS teachers are pushing kids to Bubble Sort Dance to hits like Beauty and a Beat, Roar, Gentleman, Heartbeat, Under the Sea, as well as other music.
This discussion has been archived. No new comments can be posted.

The World of YouTube Bubble Sort Algorithm Dancing

Comments Filter:
  • I don't think we should be teaching our kids exponential running time O(n^2) algorithms. Randomized partitioned merge sort theta(n lg n). Sure, bubble sorts seem harmless today, it leads to criminal token rings.

    • by stoploss ( 2842505 ) on Thursday December 25, 2014 @07:21PM (#48673723)

      I don't think we should be teaching our kids exponential running time O(n^2) algorithms.

      Call me liberal, but I don't think we should be teaching our kids improper definitions for "exponential" *or* myths that O(n^2) algorithms like bubble sort are bad.

      Quick: which is going to be faster to sort a list of 4 items, bubble sort or randomized partition merge sort? What's that you say? Proper algorithm selection requires more than knee-jerk application of platitudes? Exactly.

      • by plopez ( 54068 )

        I would just skip the sort and do a linear search. As a matter of fact I *am* that lazy.

    • Re: (Score:3, Insightful)

      by Anonymous Coward

      Believe it or not, but bubble sort really is used in the real world, and not because of incompetence.

      Now, maybe it isn't used for most cases, but it is far from being worthless. There are situations where it's really the most optimal algorithm to run, mostly where you are both space constrained (so can't afford the extra memory to allocate more than the list to be sorted), and when you want a low number of instructions to run (because there is no other algorithm which can be performed with as few instructio

      • You are correct. But there is a much more direct answer to defend Bubble Sort.

        In the real world, i.e. on real hardware, bubble sort usually faster than other algorithms for small data sets. This is due to cache locality. A cache miss can mean the difference between 4 clock cycles vs. over 400 cycles, simply waiting for 4 little bytes to be read from RAM.

        Cache misses are now the biggest problem for high performance programming. For instance, (good) video game programmers are very aware of this fact.

    • by Anonymous Coward

      Working with these algorithms exercises the brain. The benefit is not just having the knowledge, but having the mental ability to understand a complex novel problem and implement an optimal solution to it.

      I have interviewed many (and worked with a few) self-taught programmers who skipped all that "already solved" stuff and usually just hit the Internet to find ready-made solutions to their problems. There were many simple things they could do well. But once in a while a problem required the building of a

    • FYI O(n^2) is called quadratic complexity/time, O(n^3) is cubic, O(n^1) is linear and O(n^0) = O(1) is constant.

      Exponential complexity would be O(c^n), where c is a constant.

  • I'll be impressed when they dance a quicksort to Flight of the Bumblebee.

    • I'll be impressed when they dance a quicksort to Flight of the Bumblebee.

      Or a merge sort to Aaron Copland's "Fanfare of the Common Man".

  • by Tony Isaac ( 1301187 ) on Thursday December 25, 2014 @08:13PM (#48673837) Homepage

    ...than as a sorting algorithm!

  • I sent the Hungarian dance link to my Magyar uncle who is somewhat computer illiterate. This'll show him how binary can solve simple order.

Whoever dies with the most toys wins.

Working...