How Slow is This Awful Sorting Algorithm?

preview_player
Показать описание

What's worse than Bogo Sort? Well it could be Bozo Sort, a wacky random sorting algorithm. In this video we'll code Bozo Sort in Java and see how it compares to Bogo Sort

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:

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

Bro you are so underrated i dodnt even check your sub count i thought you had 1 million or something!

ethereal
Автор

See this random experiments and knowing even more different...nice ❤️.Keep going ☺️

saivamsi
Автор

throw in 100 numbers and watch your computer have a cardiac arrest.

DoFliesCallUsWalks
Автор

If you really don't like the job interview you can implement this

Donotfollow
Автор

Nice sorting technique! :) Just one question: Shouldn't there be an equality check between index1 and index2 before the swapping? (or is that redundant?)

kousav
Автор

That sorting algorithm may be O(1) actually.

meinertr
Автор

I coded some visuals in terminal for bozo sort and this is damn fast algorithm with this optimization technique :D

void optimized_bozo_sort(int* T, int n)
{
int a, b;

srand(time(NULL));

while(!is_sorted(T, n))
{
a = rand() % n;
b = rand() % n;

// optimization as hell... and it works!
if((a == b) || (T[a] == T[b]) || ((a > b) && (T[a] >= T[b])) || ((a < b) && (T[a] <= T[b])))
continue;

swapi(&T[a], &T[b]);
}
}

LuigiElettrico
welcome to shbcf.ru