Worst Sorting Algorithm Ever - #shorts

preview_player
Показать описание
Bogo sort is a terrible but hilarious sorting algorithm. Let's write it in Java!

Learn or improve your Java by watching it being coded live!

Hey, I'm John! I'm a Lead Java Software Engineer and I've been in the programming industry for more than a decade. I love sharing what I've learned over the years in a way that's understandable for all levels of Java developers.

Let me know what else you'd like to see!

Links to any stuff in this description are affiliate links, so if you buy a product through those links I may earn a small commission.

📕 THE best book to learn Java, Effective Java by Joshua Bloch

📕 One of my favorite programming books, Clean Code by Robert Martin

🎧 Or get the audio version of Clean Code for FREE here with an Audible free trial

🖥️Standing desk brand I use for recording (get a code for $30 off through this link!)

📹Phone I use for recording:

🎙️Microphone I use (classy, I know):

Donate with PayPal (Thank you so much!)

☕Complete Java course:

#Shorts
Рекомендации по теме
Комментарии
Автор

But there is still a % probability that this algorithm might outperform the fastest sorting algorithm known till date. 😂

abhirammadhu
Автор

You say it's not fast.
I say it CAN be fast.

persimmon
Автор

Everyone laughs until it gets a million entries right in a single second

natey
Автор

Bruh, that was genius. I will do this in my algoritms exam tomorrow

yourcasualdeveloper
Автор

The caveat with this algorithm is that if the shuffle method isn't a proper pseudo-random shuffle, it may never terminate. I prefer to use cosmic sort instead, which simply waits until the list is sorted by random bit flips caused by cosmic rays. That way you only have to worry about checking if the list is sorted.

Unbelievably, this algorithm also has an O(n) cousin, called quantum bogo sort. It uses entangled particles to randomly shuffle a list, and then checks if the list is sorted. If the list isn't sorted, it destroys the universe. In all the surviving universes, the list was sorted in constant time!

Temari_Virus
Автор

it's like the second most popular algorithm to assemble Rubik's cube

nucukak
Автор

Python programmers on Leetcode with their one liner solutions be like😂

abhirammadhu
Автор

If it was bad for you, it is your fault. If you are lucky it will be always the best one. Don't blame the algorithm for your bad luck

rodrigoboaventura
Автор

That is basically "shuffle and Inshaallah"

yahyasalimi
Автор

Best-case complexity for unsorted array: O(1)
Worst-case though, depending on implementation of shuffle, can be literally infinity.

Fytrzaczek
Автор

If you think that's the worst, you clearly haven't heard of bogobogosort.

catlovingtrio
Автор

"Bogosort is the slowest"
Bogobogosort joins the chat
Bogobogobogosort joins the chat
Infinite family of Bogobogosorts joins the chat




*Miracle sort joins the chat*

Nickitoks
Автор

Don't make fun of bogosort, he's just tryna learn!

garlicxi
Автор

oh god i heard 'shuffle' and physically recoiled

snartboy
Автор

Everyone is gansta until the miracle sort comes.

BrownSloth
Автор

This is the equivalent of hitting a tree with a wrench until you make a chair.

ytuser
Автор

Just laughed till tears. Brilliant humour, man!

I_O_O_I
Автор

Miracle sort will always be my favorite sorting algorithm that theoretically can succeed.

CreamusG
Автор

"2 line sorting algorithm"
The other lines:

marble
Автор

this is the worst sorting algorithm and the best at the same time

girres
visit shbcf.ru