Jump to content

Photo

Fun with Sorting Algorithms


  • Please log in to reply
8 replies to this topic

#1 SushiKitten

SushiKitten

    Coffee Cat

  • Members
  • 1,916 posts
  • LocationCanada

Posted 23 November 2014 - 12:29 AM

The other night I had way too much fun on YouTube. I was introduced to the idea of bogosort and how inefficient it is earlier this week, and that lead to the wonderful adventure I'm about to retell here.

 

There's a whole series of Hungarian dance interpretations of sorting algorithms and I love them all.

 

There's also sleep sort, which apparently was formed on 4chan:

http://dis.4chan.org...prog/1295544154

 

Also this one is just too nerdy not to share. I hope it's a school assignment, otherwise, all I can see is the guy in the wizard hat trying to coerce his friends into doing this, "C'MON GUYS, IT'LL BE FUN"



#2 No-Danico

No-Danico

    Danger Zone

  • Members
  • 1,776 posts
  • LocationGA, USA

Posted 23 November 2014 - 12:54 AM

You are a damn queen nerd, aren't you?  I barely even understand this weird math shit.

 

When he made the kid kneel on the second run through, I was sort of hoping he'd go all Conan and decapitate him, then take his woman on the cul-de-sac in his still warm blood.

 

Also, I Googled bogosort, cuz I'm an English major, and this was the best explanation I found:

 

'If bogosort were used to sort a deck of cards, it would consist of checking if the deck were in order, and if it were not, throwing the deck into the air, picking the cards up at random, and repeating the process until the deck is sorted. Its name comes from the word bogus'

 

What sort of dry mental masturbation is that?


ElectricSevereKatydid.gif

My first novel, Seeds of Magic- Barnes & Noble, Smashwords, Kobo, Sony Store


 


#3 Mister Sympa

Mister Sympa

    Ascended Prophet

  • Moderators
  • 4,444 posts
  • LocationUSA, Earth, Milky Way

Posted 23 November 2014 - 06:02 PM

5887275831d21884be7e65263e1fc923.gif

f8e09be68a884c5693a6471b01d3b6c2.gif

e264e7c0a461f77e40ee1d7005ece076.gif

 

 

 

 

Not that it's a bad thing; honestly, I think you should get an award.


tumblr_ojjqahjSmc1rtecnto2_400.gif


#4 SpleenBeGone

SpleenBeGone

    Deer Leader of the Goriest Revolution

  • Administrators
  • 14,951 posts
  • LocationHouston

Posted 24 November 2014 - 06:59 AM

I remember in college learning about different sort methods and there was never any visual representation. I'm a very kinetic learner so it was kinda irritating. 

I don't know that I learned any more from these guys, but it sure was fun to watch. >.>

 

 

'If bogosort were used to sort a deck of cards, it would consist of checking if the deck were in order, and if it were not, throwing the deck into the air, picking the cards up at random, and repeating the process until the deck is sorted. Its name comes from the word bogus'

This made me crack up. Luckily no one is around this early. 


nmjUGDL.jpg

#5 SushiKitten

SushiKitten

    Coffee Cat

  • Members
  • 1,916 posts
  • LocationCanada

Posted 24 November 2014 - 09:52 AM

'If bogosort were used to sort a deck of cards, it would consist of checking if the deck were in order, and if it were not, throwing the deck into the air, picking the cards up at random, and repeating the process until the deck is sorted. Its name comes from the word bogus'

 

What sort of dry mental masturbation is that?

My favourite is the quantum alternative to this:

 

"First, use quantum randomness to permute the list. The quantum randomization creates n! branches of the wavefunction ("universes" in many-worlds interpretation), and one of these will be such that this single shuffle had produced the list in sorted order. The list is then inspected, and if it is not sorted, the universe is destroyed. Since destroyed universes cannot be observed, the list is always observed to have been successfully sorted after one iteration (having done O(n) work)."

 

Basically, is the list in order? If not, each universe we just made is destroyed. But since we can't observe destroyed universes, the list must be in order! 



#6 Mister Sympa

Mister Sympa

    Ascended Prophet

  • Moderators
  • 4,444 posts
  • LocationUSA, Earth, Milky Way

Posted 24 November 2014 - 04:52 PM

I'm not an idiot, but damn this stuff is out of my reach.


tumblr_ojjqahjSmc1rtecnto2_400.gif


#7 No-Danico

No-Danico

    Danger Zone

  • Members
  • 1,776 posts
  • LocationGA, USA

Posted 24 November 2014 - 07:23 PM

My favourite is the quantum alternative to this:

 

"First, use quantum randomness to permute the list. The quantum randomization creates n! branches of the wavefunction ("universes" in many-worlds interpretation), and one of these will be such that this single shuffle had produced the list in sorted order. The list is then inspected, and if it is not sorted, the universe is destroyed. Since destroyed universes cannot be observed, the list is always observed to have been successfully sorted after one iteration (having done O(n) work)."

 

Basically, is the list in order? If not, each universe we just made is destroyed. But since we can't observe destroyed universes, the list must be in order! 

 

Taking off his goggles, mathematician one's eyes search the fragmented remains of the universe for a hint of success. His mind raced as it sorted out the facts of their failure. "It wasn't sorted."

 

With a scowl on his tired face, mathematician two barks at his colleague, "Fuck no! We destroyed everything." His eyes flicker to the photo on his desk. A woman and a venusian pureblood smile at the lunar camera. It was such a happy memory, but that is all it is, a memory.

 

Mathematician one shakes his head slowly as a mad grin grows on his face. "No. This is good. It's sorted now."

 

"No it didn't!" Number two waves his gloved hand at the quickly cooling remains of everything that will ever be. "We have to fix things! Then we work on finding the solution."

 

"No, no." Mathematician one says as he pulls his proton revolver from his lab coat. He puts a single plasma slug between his best friend's eyes, then places the gun on the console. With everything gone, the solution was correct. Greg couldn't understand. There couldn't be anything. Nothing. Nothing left at all.

 

Taking a final swig of Klingon coffee as a pathetic final meal, the last man lifted the proton revolver a final time and put the final bracket on the final formula to ever exist. His last thought didn't drift to his wife or his kids, or even his childhood friend whose body was smoldering on the floor like a brisket of coal. As he squeezed the trigger, the last thing that went through his mind was a balled slug of entropy.    


ElectricSevereKatydid.gif

My first novel, Seeds of Magic- Barnes & Noble, Smashwords, Kobo, Sony Store


 


#8 Mister Sympa

Mister Sympa

    Ascended Prophet

  • Moderators
  • 4,444 posts
  • LocationUSA, Earth, Milky Way

Posted 24 November 2014 - 07:27 PM

Douglas Adams and Terry Pratchett called.

 

 

They're impressed.


tumblr_ojjqahjSmc1rtecnto2_400.gif


#9 SushiKitten

SushiKitten

    Coffee Cat

  • Members
  • 1,916 posts
  • LocationCanada

Posted 25 November 2014 - 08:51 AM

Taking off his goggles, mathematician one's eyes search the fragmented remains of the universe for a hint of success. His mind raced as it sorted out the facts of their failure. "It wasn't sorted."

With a scowl on his tired face, mathematician two barks at his colleague, "Fuck no! We destroyed everything." His eyes flicker to the photo on his desk. A woman and a venusian pureblood smile at the lunar camera. It was such a happy memory, but that is all it is, a memory.

Mathematician one shakes his head slowly as a mad grin grows on his face. "No. This is good. It's sorted now."

"No it didn't!" Number two waves his gloved hand at the quickly cooling remains of everything that will ever be. "We have to fix things! Then we work on finding the solution."

"No, no." Mathematician one says as he pulls his proton revolver from his lab coat. He puts a single plasma slug between his best friend's eyes, then places the gun on the console. With everything gone, the solution was correct. Greg couldn't understand. There couldn't be anything. Nothing. Nothing left at all.

Taking a final swig of Klingon coffee as a pathetic final meal, the last man lifted the proton revolver a final time and put the final bracket on the final formula to ever exist. His last thought didn't drift to his wife or his kids, or even his childhood friend whose body was smoldering on the floor like a brisket of coal. As he squeezed the trigger, the last thing that went through his mind was a balled slug of entropy.

I can't read this yet, I'm slacking off in class and I'll laugh too hard but oh my god.

EDIT: A pure masterpiece.