Quick Sort Algorithm in Python (Full Code) 🐍

Learn quick sort with full Python code in this beginner-friendly tutorial. Part of our comprehensive algorithm series.

Quick Sort Algorithm in Python (Full Code) 🐍
Derrick Sherrill
203.0K views β€’ Sep 9, 2019
Quick Sort Algorithm in Python (Full Code) 🐍

About this video

This is a part of a full algorithm series - Check it out here:
https://www.youtube.com/watch?v=g_xesqdQqvA&list=PLc_Ps3DdrcTsizjAG5uMhpoDfhDmxpOzv

Kite helps fund the channel, thanks for checking them out and supporting me --
⭐ Kite is a free AI-powered coding assistant that will help you code faster and smarter. The Kite plugin integrates with all the top editors and IDEs to give you smart completions and documentation while you’re typing. https://www.kite.com/get-kite/?utm_medium=referral&utm_source=youtube&utm_campaign=derricksherrill&utm_content=description-only

#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!
FB - https://www.facebook.com/CodeWithDerrick/
Insta - https://www.instagram.com/codewithderrick/
Twitter - https://twitter.com/codewithderrick
LinkedIn - https://www.linkedin.com/in/derricksherrill/
GitHub - https://github.com/Derrick-Sherrill

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:
pivot = sequence.pop()

items_greater = []
items_lower = []

for item in sequence:
if item #greater than pivot:
items_greater.append(item)

else:
items_lower.append(item)

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!

https://github.com/Derrick-Sherrill/Python-Algorithms-YouTube-Series/blob/master/4-Quick_Sort.py

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:
https://github.com/Derrick-Sherrill/DerrickSherrill.com

Check out my website:
https://www.derricksherrill.com/

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?
Atom - https://atom.io/

What Equipment do you use to film videos?
https://www.amazon.com/shop/derricksherrill

What editing software do you use?
Adobe CC - https://www.adobe.com/creativecloud.html
Premiere Pro for video editing
Photoshop for images
After Effects for animations

Do I have any courses available?
Yes & always working on more!
https://www.udemy.com/user/derrick-sherrill-2/

Where do I get my music?
I get all my music from the copyright free Youtube audio library
https://www.youtube.com/audiolibrary/music?nv=1

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!

Tags and Topics

Browse our collection to discover more content in these categories.

Video Information

Views

203.0K

Likes

7.0K

Duration

6:01

Published

Sep 9, 2019

User Reviews

4.7
(40)
Rate:

Related Trending Topics

LIVE TRENDS

Related trending topics. Click any trend to explore more videos.