Worst Sorting Algorithm Ever? Let's Try Bogosort in Java

Опубликовано: 22 November 2026
на канале: Coding with John
32,837
1.3k

☕ JAVA COURSE:
https://codingwithjohn.com/javacourse
Stop piecing together random tutorials. My beginner's Java course takes you from your very first line of code all the way to OOP and streams — in the right order, with zero gaps.

📚 Books that made me a better programmer:
📕 Effective Java by Joshua Bloch — THE Java book. If you read one Java book, make it this one:
https://link.amazon/B0hdKN8x6
📗 Head First Java — the most beginner-friendly Java book I know:
https://link.amazon/B09BEeN64
📕 Clean Code by Robert Martin — My favorite programming book:
https://link.amazon/B07ZMdWKD

📹 Camera I use for recording:
https://link.amazon/B09CGb9vK
🎙️ Microphone I use:
https://link.amazon/B0cB5Z9Hu

🎧 Free audiobook from Audible:
https://link.amazon/B08rKLhvh
🛒 Free Amazon Prime trial:
https://link.amazon/B0facGxHT
Some links above are affiliate links — if you buy through them I may earn a small commission that supports the channel at no extra cost to you.

💬 What should I cover next? Drop it in the comments.

🔁 Still reading? If you're serious about learning Java properly instead of hoping random videos cover everything: https://codingwithjohn.com/javacourse

❤️ Donate via PayPal (thank you so much!): https://www.paypal.com/donate/?hosted...
🌐 https://codingwithjohn.com

Let's try out Bogosort in Java! One of the worst but most entertaining sorting algorithms in the world.
Full source available HERE, if you want to do this to yourself: https://codingwithjohn.com/bogosort-s...
Also called random sort, permutation sort, slow sort, stupid sort, shotgun sort, shuffle sort, or even derp sort. This algorithm is widely regarded as one of the world's worst, most ridiculous sorting algorithms.

But it's a lot of fun to create, and super easy!

This is a beginner friendly Java coding lesson tutorial, where we'll create a full Java program that sorts a list of numbers using Bogosort, one of worst sorting algorithms ever, in Java.

Hey, I'm John! I'm a Lead Java Software Engineer who has been in the 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.

🖥️Standing desk brand I use for recording (get a code for $30 off through this link!)
https://bit.ly/3QPNGko