Home Creators Posts Import Register Favorites Logout

Content

Director Rhys here! This one was a fun one to film but my oh my did it take me a while to get my head around the algorithm...

Matt first came across the paper this algorithm was in about five years ago but we've only now decided to make a video about it. It shouldn't sort. Or at least when you look at the pseudo-code it feels like it shouldn't sort. But it does. That's not a spoiler, but I can't say too much more without giving it all away.

Suffice to say we had many, many takes of the physical sorting passes. We knew we had it right when Cameraperson Alex nodded along with a satisfied grin.

I thought it would have been fun to do it with different sized fruits, start with a grape and go all the way up to watermelon. But then they would have rolled all over the place. Instead we cut out a bunch of coloured squares (thanks left over post-it notes from the paper size video!) and put them on stands (thanks Magic the Gathering video!). If you look pretty closely you'll see which squares I cut out as they're not exactly square. I blame the terrible scissors we had available. And my terrible cutting ability.

The thing we all genuinely love about this is that it wasn't designed to be a stupid but functional sorting algorithm (I'm looking at you Bogosort) but just happens to be one. Beautiful.

We also considered trying to get a fun sonification of the algorithm asking some people to play piano for us but in the end it didn't fit the flow of the video. Maybe next time.

What's your favourite sorting algorithm. I know that asking that question here is totally legitimate. I must say I am rather a sucker for sleep sort. Gentle and inefficient.

Spot any errors or the like then do let us know. As ever genuine and huge thanks for all of your support which literally keeps the channel going. You are all fantastic :D

Files

Is this the worst sorting algorithm ever?

Click this link https://boot.dev/?promo=STANDUPMATHS and use my code STANDUPMATHS to get 25% off your first payment for boot.dev Stanley P. Y. Fung’s original paper can be found here: https://arxiv.org/pdf/2110.01111 Along with an addendum to paper answering all of your burning questions here: https://www.cs.le.ac.uk/people/pyf1/sorting.html The viral video of sorting algorithms visualiser and sonifier is here: https://www.youtube.com/watch?v=kPRA0W1kECg And more info on the sonifier: https://panthema.net/2013/sound-of-sorting/ If you want some info on genuinely useful sorting algorithms the check out Boot.Dev’s video: https://www.youtube.com/watch?is=mIPDDmyo9IP5iaeZ&v=GMV7ycKZ-mM&feature=youtu.be Thank you to Andy Chisholm for creating the brilliant sound effects for the SWAP graphic. Find him over at www.andychisholm.com For more unnecessary detail, tickets for upcoming London shows are available here: https://festivalofthespokennerd.com/tickets/ Huge thanks to my Patreon supporters.There is no sorting algorithm I have yet found which could put them in order. https://www.patreon.com/standupmaths CORRECTIONS - None yet, let me know if you spot anything! Filming by Alex Genn-Bash Editing by Gus Melton Written and performed by Matt Parker Directed by Rhys Jones Produced by Nicole Jacobus Music by Howard Carter Design by Simon Wright and Adam Robinson MATT PARKER: Stand-up Mathematician Website: http://standupmaths.com/ Click this link https://boot.dev/?promo=STANDUPMATHS and use my code STANDUPMATHS to get 25% off your first payment for boot.dev Stanley P. Y. Fung’s original paper can be found here: https://arxiv.org/pdf/2110.01111 Along with an addendum to paper answering all of your burning questions here: https://www.cs.le.ac.uk/people/pyf1/sorting.html The viral video of sorting algorithms visualiser and sonifier is here: https://www.youtube.com/watch?v=kPRA0W1kECg And more info on the sonifier: https://panthema.net/2013/sound-of-sorting/ If you want some info on genuinely useful sorting algorithms the check out Boot.Dev’s video: https://www.youtube.com/watch?is=mIPDDmyo9IP5iaeZ&v=GMV7ycKZ-mM&feature=youtu.be Thank you to Andy Chisholm for creating the brilliant sound effects for the SWAP graphic. Find him over at www.andychisholm.com For more unnecessary detail, tickets for upcoming London shows are available here: https://festivalofthespokennerd.com/tickets/ Huge thanks to my Patreon supporters.There is no sorting algorithm I have yet found which could put them in order. https://www.patreon.com/standupmaths CORRECTIONS - None yet, let me know if you spot anything! Filming by Alex Genn-Bash Editing by Gus Melton Written and performed by Matt Parker Directed by Rhys Jones Produced by Nicole Jacobus Music by Howard Carter Design by Simon Wright and Adam Robinson MATT PARKER: Stand-up Mathematician Website: http://standupmaths.com/

Comments

epinardscaramel

Oh, interesting visualisation of sorting algorithms using pictures instead of simple bars!

Tristan Pye

At 7:27, you mean “if L[i] > L[i+1]” rather than “if i > i+1”. Similarly with i & j at 10:00.

Rick Rubenstein

Well, he did say that it was terrible pseudocode. (Also that he wanted to not get hired, so there's that...)

Rick Rubenstein

Upon reading the post title, I thought "Huh, that doesn't *look* like functional programming..." (Fortunately you don't use "functional" in the actual video title as it currently stands, or the Haskell folks would be on you like a... wayward monad or something.)

Valkhiya

As someone with auditory sensitivity, the sonification of the algorithm near the end is *very* harsh. It would help a lot if it was a bit quieter and slightly lower pitched. (also you misspelled "insertion" at 17:25)

UsrBinPRL

Came here to say this. i is seldom greater than i + 1.

Blue 5alamander

When you talk about the Tim Sort you misspell insertion (I think it was "inserstion" you had)

Andrew Weir

> What's your favourite sorting algorithm. KidSort. "Hey kids, sort this bucket of Lego into similar colours. If you do it all, I'll give you a pound each." Cheap, effective, almost reliable.

Tim Goddard

My favourite algorithm conceptually has to be heap sort (in place, using an implicit binary heap). But really, I just want people to be lazy and only sort enough to produce the number of results they want.

Rich Holmes

Slowsort, described in "Pessimal Algorithms and Simplexity Analysis" by Andrei Broder and Jorge Stolfi, one of the funniest academic papers you'll ever read. "For practical applications, it is obvious that slowsort is the eminently suitable algorithm whenever your boss sends you to sort something in Paris."

Timur Sultanov

My favorite terrible sorting algorithm that is functional is stooge sort, it is deterministic, but it performs worse than n² because it does way more comparisons than required.

LifeSizeTeddyBear

Yeah, he was showing off Parker Sort, rather than Bubble Sort

Vincent Zalzal

I also found this confusing at first, and in the case of i and j at 9:30, it could genuinely have been interpreted both ways (indices or array contents).

Vincent Zalzal

While I never used it, I really like radix sort, both its visualisation and sonification.

Vincent Zalzal

Hey, you said the M word! I agree it is a good thing "functional" was removed from the title.