Quick Sort Algorithm Explained (Full Code Included) - Python Algorithm Series for Beginners

preview_player
Показать описание
This is a part of a full algorithm series - Check it out here:

Kite helps fund the channel, thanks for checking them out and supporting me --

#Python #QuickSort #Algorithm

In this one we're covering the quick sort algorithm! One of the favorite sorting algorithms due to its speed in an average case.

The Quick Sort algorithm takes an item from the unsorted list and uses it as the 'pivot' or the item to compare the remainder of the items in the list. We do comparisons placing the items in lists according to if they are larger or smaller than the pivot value.

We repeat this process creating smaller and smaller lists until we have list values of one which have been sorted.

Join The Socials -- Picking Shoutouts Across YouTube, Insta, FB, and Twitter!

Thanks so much for the continued support of the channel! You guys are awesome and I'm very thankful to be at this point. 5,500+ subscribers at the time of writing. Thank you all so much!

*****************************************************************
Full code from the video:
def quick_sort(sequence):
length = len(sequence)
if length #less than= 1:
return sequence
else:

items_greater = []
items_lower = []

for item in sequence:
if item #greater than pivot:

else:

return quick_sort(items_lower) + [pivot] + quick_sort(items_greater)

print(quick_sort([5,6,7,8,9,8,7,6,5,6,7,8,9,0]))
#Youtube Doesn't allow angled brackets - Sorry about that!

Packages (& Versions) used in this video:
Python 3.7
Atom Text Editor

*****************************************************************
Code from this tutorial and all my others can be found on my GitHub:

Check out my website:

If you liked the video - please hit the like button. It means more than you know. Thanks for watching and thank you for all your support!!

--- Channel FAQ --

What text editor do you use?

What Equipment do you use to film videos?

What editing software do you use?
Premiere Pro for video editing
Photoshop for images
After Effects for animations

Do I have any courses available?
Yes & always working on more!

Where do I get my music?
I get all my music from the copyright free Youtube audio library

Let me know if there's anything else you want answered!

-------------------------

Always looking for suggestions on what video to make next -- leave me a comment with your project! Happy Coding!
Рекомендации по теме
Комментарии
Автор

This is the best explanation I have seen so far. It’s like other people try to explain things in the hardest way possible so you could think they’re more smart lol

NEMOBANDZBEATS
Автор

Wtf man I'm literally stunned on how easy you made it.

sagarsonkar
Автор

Hey man, you are one of the most underrated channels on youtube for Python. It is sad to see you haven't uploaded in a while, but I hope everything is going well for you. Thank you for all you have done.

ugurdev
Автор

this is the cleanest implementation of quicksort that I have seen. period. So easy to follow! Subscribed

tai-shanlin
Автор

I wish every video on the internet was like this. You made my day, for real.

ctormin
Автор

Why is this dude so underrated . I was searching for tutorials of sorting algorithms I didn't find a single video which explained well and mostly all the sorting videos were about bubble sort . Now after 2 days his video come to my recommendation.And yeah bro keep up the good work I can't even explain how much these sorting tutorials helped me keep it up . You will surely get what you deserve once👍👍😁

fuleswaripal
Автор

I kept thinking, I know I'm not stupid. I know I understand the logic. Why can't I understand anyone's CODE? and then I found this video. This code & your explanation is EXACTLY how my brain works and understands it. thank you for rocking.

linneadahmen
Автор

Great tutorial! However, quicksort is an in-place algorithm. This implementation is not in-place since it creates new lists rather than modifying the original. The in-place version is naturally a bit trickier, which is why most people seem to get your version better. Nevertheless, this video does a great job in explaining the intuition behind the algorithm.

nikomiller
Автор

Although it isn't in-place, your tutorial was very simple to understand and should definitely be how Quicksort ought to be taught!

Sixthfred
Автор

just found this channel rn and this dude is so easy to understand and chill (but not boring) untapped resource of knowledge right here

zesjqyq
Автор

This was incredible. Thank you for explaining these algorithms in simple terms for beginners to understand. Your explanations are clear and your code clean. Cannot be thankful enough.

UnrecycleRubdish
Автор

Much more efficient and straight-to-the-point video than a lot others, thanks

Clipoze
Автор

I'd definitely recommend this channel to everyone who wants to learn DSA in a very clear and easy-to-understand way. Thanks Derick Sherrill for this tutorial. Keep posting more and more videos

glorysonhorace
Автор

Oh my god !! The best video of quick sort ! This is the first time I visited your channel and I'm totally recommending this to all my friends !!! thanks s lot ❤️❤️

anshimagarg
Автор

man ur amazing, understood first time quick sort in my life

pratikzajam
Автор

I appreciate that you take pains to make the coding easy to read. Many coding videos are essentially useless because the presenter doesn't magnify the code.

jesuisravi
Автор

this kind of videos i wish i found for every algorithm i am searching..
1) sort..really sort
2) straight to the explanation with example with nice visuals
3) code, simple and 1 to 1 match with the example and without any fancy and useless coding elements

easynow
Автор

this is the BEST explanation of quicksort, EVER.

webknowledge
Автор

Hands down, The best tutorial ever, !!
guys if you do not understand the recursion logic, just take a pen and paper and write down the iterations yourself, it will be very easy to understand.

victorML-lmmu
Автор

With all that animation and description, it was great. So clean. I'm a beginner at programming and yet all this made complete sense. Thanks, man. Subscribed.

kyvlwmj
welcome to shbcf.ru