Sorting algorithms demonstrated with Hungarian folk dance

Posted to Coding  |  Tags: , ,  |  Nathan Yau

We’ve seen sorting algorithms visualized and auralized, but now it’s time to see them through the spirit of Hungarian folk dance. In a series of four videos (so far), folks at Sapientia University in Romania demonstrate how different sorting algorithms work with numbered people dancing around and arranging themselves from least to greatest.

See them in action in the video below. This one is for Bubble-sort. They move with such zest.

[Video Link via @shancarter & Boing Boing]


  • I would have watched this unendingly on Sesame Street. It’s an awesome candidate for the show!

  • maurice vergeer April 14, 2011 at 2:20 am

    so this is why SPSS takes long to sort data files :-)

  • It is worth noting that there’s a bug in the video. When they do the first pass two dancers become part of the sorted array even though only 9 should have done so.

    • Herbert P. April 15, 2011 at 4:00 am

      No bug in pass 1.The error is committed by dancer 6 when he fails to turn around in pass 2 after seeing that his partner (to his left) has turned around. It is obvious from watching subsequent passes that the criterion for what is already sorted makes use of the contiguity of the sorting key. Although it is inconsistent that this data property is not also used to eliminate at an early stage sorted elements at the low end, this is probably done to keep the sort reasonably bubbly.

  • nick tulip April 14, 2011 at 7:33 am

    I don’t know how you reached the conclusion that it’s a Hungarian folk dance.

    • nick tulip April 14, 2011 at 7:34 am

      obviously it’s in the video title and it’s created by hungarians – but it’s also very Romanian.

      • .NetRolller 3D April 14, 2011 at 1:53 pm

        Definitely Hungarian – specifically, a Gyimes Csángó dance. I have a few Gyimes Csángó friends myself, and they would definitely protest being called “Romanians”.

  • It looks to me like they’re using _Hungarian Notation_ for this dance! :D

  • This begs the question: can dance-based computing scale? Boy, this post makes me hungry for lángos… =D

  • lovely! :D
    i must say that dance is more awesome then the bibble sort algo itself :D

    i noticed the dance not the algorithm :P

  • I felt panic when they started dancing again at the end. “NOOO! The array is sorted! Don’t move!”

  • It would have been interesting to see them do a bucket sort. Much faster, but shorter duration. Perhaps a Radix Sort might be interesting as well, but would require more people. This opens a new genera of dance for searching algorithms, skip searches, Linked List Searches, Corral Rings, and perhaps bi-directional linked lists and linked list insertions and deletions? What great fun.

  • Nice. Reminds me of the video survey of sort algorithms done by the Knight School’s Algorithmic Thinking class:

  • who can tell me what’s the name of this song???

  • very cute. I will use this fall when I teach data structures


Shifting Incomes for American Jobs

For various occupations, the difference between the person who makes the most and the one who makes the least can be significant.

Unemployment in America, Mapped Over Time

Watch the regional changes across the country from 1990 to 2016.

10 Best Data Visualization Projects of 2015

These are my picks for the best of 2015. As usual, they could easily appear in a different order on a different day, and there are projects not on the list that were also excellent.

Reviving the Statistical Atlas of the United States with New Data

Due to budget cuts, there is no plan for an updated atlas. So I recreated the original 1870 Atlas using today’s publicly available data.