Selection Sort: Background & Python Code

preview_player
Показать описание
In this lesson we'll introduce the Selection Sort algorithm, a very simple approach to sorting lists and arrays. After covering the basics, we'll open up a coding editor and implement the algorithm in Python, at the end we'll benchmark the performance of the algorithm against various other sorting approaches, including our Bubble Sort from the prior video.

References:

End song is "Paris" by LASERS.
Рекомендации по теме
Комментарии
Автор

you`r channel super cool. Thanks for your job.

Oryx_
Автор

It would be far more pythonic to replace the for loop in the code from lines 13 to 18 with a single call to the "min" function, but I've refrained from this so that the code can be more portable to other languages. Take note that if you're sticking to Python, lines 13 to 18 could be replaced with the following single line of code:



For further simplification, you may choose to replace the sort_len declaration and while loop on lines 11 and 12 with a single for loop [for sort_len in range(len(a))], in which case you wouldn't need to increment the sort_len variable on each iteration (line 20).

BrianFaure
Автор

Quality videos Brian!! Just wasn't sure about the purpose by initializing min_idx=None instead of min_idx=0?

harunsalman
Автор

Great video, I'm just having a little trouble understanding one small part why do you add sort_len in the line min_idx = i + sort_len, why not just min_idx = i?
Thanks

Promar
Автор

need help: sponge_gar.zip not found
How do i fix this

eytchde
Автор

if the default method is better than these sorting techniques then why do we use them??

isha
Автор

Great explanation. As good as CS50 from Harvard.

nashaeshire
Автор

Bla bla bla bla, why is this video so fast

mishavlog
visit shbcf.ru