Selection Sort Tutorial in Java: The Snail's Guide to Sorting

preview_player
Показать описание
Let's learn the Selection Sort algorithm, and code it in Java!

Selection Sort is a great sorting algorithm for beginning programmers to learn. It's just a few lines of code and makes a great coding exercise. But Selection Sort isn't exactly the fastest algorithm out there...

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

Hi, 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 learners.

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.

00:00 What we're gonna do
00:19 How Selection Sort Works
03:05 The Code
10:43 How Fast is It?
12:33 What about 1 million?

📕 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!)

📹Camera I use for recording:

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

Donate with PayPal (Thank you so much!)

☕Complete Java course:

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

I wrote my first bubble sort, selection sort, and shell sort in 1981 in BASIC. I have no need to learn to sort anything, but I watch this because I love how you present it so nicely. You do a great job John!

richardhasting
Автор

I am currently taking a Data Structures and Algorithms course using Java and one of my assignments was to implement a variety of different sorting algorithms. You explain them and their implementations in a very understandable way, honestly better than my professor does. You just earned yourself a new subscriber!

oofdayz
Автор

I like your presentation style, other YouTubers could learn much from this. You start by explaining what we're going to be doing before starting. You continue to explain as you go. And you do it all at a moderate speed that doesn't sound like you're trying to finish a 20 min lesson in 5 min (or on 400 tabs of speed). Also great is the lack of background music everyone thinks they have to add some but it only competes with one's voice.

TheDeathMongrel
Автор

Love the content as always! I look forward to a spring tutorial:)

Blezerker
Автор

Great to see more content from you John. I assume I would mentally file this in the beginner programmer category as it's a great little teaching exercise or test for someone.

misterwoody_
Автор

great video, just what i needed. couldn't understand selection sort for the past two three months

notme-br
Автор

Hi @John you make us visualize so well..
I need to work with a single loop to optimize though I've not tried it yet

sekharsamanta
Автор

After watching several videos and still not understanding the core principal, your video helped me understand it clearly. Thanks a lot.

ravenklaus
Автор

Hi sir, you are doing gods work for java beginners, you really are the John 🙏

sandeepsindhu
Автор

Thank you John🙂You're such an amazing teacher.

michael_scarn_
Автор

your explanation is truly amazing! Thanks!

yikechen
Автор

This is very nice. I'll watch your quick sort and merge sort algorithms. I imagine that you will use an Arraylist, because you explain in your other videos that these are faster for searches (use constant time), but I am a coding noob theorizing. I am excited to see how you do it.

CarlosCed
Автор

Hey can you do a tutorial on network programming for Java? Such as sockets, network client servers, application level protocols etc. Please it would be a big help as your the best teacher for java on Youtube so far.

dennisysj
Автор

The best youtuber yet on data structures presentation, bravo mate 🫡❤🔥

hbflx
Автор

Hello John,

I don't comment often, but I would just like to take the opportunity to thank you for all your videos. Your tutorials are simply incredible and I wish more people taught in the style you teach in. Whenever I forget how to work with something, rather than looking for an example online I often just rewatch your videos.

I am not sure if you take requests for topics to cover, but there is one topic I would absolutely love to see on your channel. I have been messing around with Serialization recently and the fact that it even exists kind of blows my mind. I don't understand how it works at all and I cannot find any good explanations of it that I understood. I am unsure if this topic is simply not very well known or if it is too advanced, but I would love to actually understand how it works, because right now, it feels like absolutely magic!

I totally understand if you do not want to cover this, I know any other topic you cover will be equally amazing, but if you do consider it, it would make me very happy! If you are not interested in this topic, do you perhaps know a good source to learn how serialization works? Anyways, keep doing what you do, because your videos are simply wonderful!

rubens_cube
Автор

Huh your code example actually showed me a small bug in my library, where i didn't do the "to-1" in the outer loop.
And just fixed that.

Luckily it was just a tiny oversight ^^ (I have unit test run on it but that one didn't get caught xD)

Great video!

Speiger
Автор

More videos on Java APIs please John 😁🙏

amaralensheriff
Автор

Can you make a video about JPA(Java Persistence API) specification and JPQL(Java Persistence Query Language)?

megasusmegajos
Автор

Really nice... So I ve got a question. What is the purpose of using selection sort if it is so slow?

ztvkjqw
Автор

NIce videos buddy and really useful. By the way, you might consider to make a tutorial about javaFX in order to design some nice interfaces and afterward develop the beautiful logic. I am not by any mean a developer (yet) but I'm working myself in a small project (just for fun) about a calculator.

miguelangelavilagalan
join shbcf.ru