Learn Selection Sort in 8 minutes 🔦

preview_player
Показать описание
data structures and algorithms selection sort algorithm

#selection #sort #algorithm

// selection sort = search through an array and keep track of the minimum value during
// each iteration. At the end of each iteration, we swap variables.

// Quadratic time O(n^2)
// small data set = okay
// large data set = BAD

music credits 🎼 :
===========================================================
Block Party - Bad Snacks
===========================================================
Рекомендации по теме
Комментарии
Автор

public class Main{

// selection sort = search through an array and keep track of the minimum value during
// each iteration. At the end of each iteration, we swap values.

// Quadratic time O(n^2)
// small data set = okay
// large data set = BAD

public static void main(String[] args) {

int array[] = {8, 7, 9, 2, 3, 1, 5, 4, 6};

selectionSort(array);

for(int i : array) {
System.out.print(i);
}
}

private static void selectionSort(int[] array) {

for(int i = 0; i < array.length - 1; i++) {
int min = i;
for(int j = i + 1; j < array.length; j++) {
if(array[min] > array[j]) {
= j;
}
}

int temp = array[i];
array[i] = array[min];
array[min] = temp;
}

}
}

BroCodez
Автор

Half of my tension wipes away when he says sit back and relax

faizanhamza
Автор

Man, I wish you will become the greatest programming YouTuber in a year <3

mykytakaida
Автор

Studying as usual one day before a test and I was so confused on selection sort, but this video has helped me a lot! Thanks and keep up the great work!

adi_is_back
Автор

A man uses paint to explain in 8 minutes an algorithm and achieves more than a professor at the university in 6 Months. Well done and thanks.

halloheinz
Автор

Bro, ,
Programming tortures me due to the bad teachers I have
But u, r the best programmer and teacher
U help me learn programming like it is just a childhood game.
Thanks a lot !,

hridayinfovlogs
Автор

I'm studying to become a software engineer atm... and I keep returning here time and time again for insanely good and fast introductions to pretty much ALL the concepts 🤣🤣 Bro is the master. Thank you!

j.m
Автор

I'm just going to leave this comment on your most recent video for the best chance of you seeing it.

You are insane. I'm going through your Python full course video atm and I'm about 3-4 hours in, and I just noticed that you have full course/crash course videos for several different programming languages and then also HTML/CSS on top of that.

That's amazing. I might even poke through your Java course just to see what new things I'll learn even though I already know a pretty good bit about Java.
I'll probably watch your Java swing videos since I don't know a whole bunch about swing.

This channel deserves *MUCH* more attention.

MinecraftTestSquad
Автор

Bro, you use very accurate analogies. They say that when you master a subject, you can explain it to a 6 year old child or a dumb adult (I'm the latter). Your channel is worth pure gold

juanbelmonth
Автор

I have seen that many people love Bubble sort because it is easier to learn however I think Selection sort is better as it seems simpler to me other than being faster than Bubble sort.

Anonymationsthecoolanimator
Автор

holy crap its a two

that quote killed me hahahaha

lellal
Автор

Everybody gangsta till your teacher gives sorting algorithm assignment on *linked lists with multiple variables* .

necothegrim
Автор

Thank you so much for this video bro!!! It was really helpful

supernovic
Автор

Best selection sort explanation on Youtube

LeoLeo-usrs
Автор

This was really helpfull. It made selection sort a piece of cake. Thanks a lot. Outstanding video

nidarr
Автор

Hi bro. I just discovered this youtube channel so I'm happy. I learn English about for 1 years and I'll watch your videos

kenanturan
Автор

Thanks brother, I really liked your explanation and the effort you made to graphically show the algorithm. Cheers!

diegoortega
Автор

best Explanation + nice examples = This Video

nareshmangalpalli
Автор

Thanks for the visual presentation.
I figured out how tk do it on my own thanks to the slide.

raihanrony
Автор

It's basically the naive way of sorting, but slightly smarter because the array gets smaller each iteration.

Thanks for the video!

patrickmayer