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

  Рет қаралды 181,679

Derrick Sherrill

Derrick Sherrill

Күн бұрын

Пікірлер: 407
@ugurdev
@ugurdev 3 жыл бұрын
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.
@NEMOBANDZBEATS
@NEMOBANDZBEATS 3 жыл бұрын
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
@ctormin
@ctormin 4 жыл бұрын
I wish every video on the internet was like this. You made my day, for real.
@nikomiller6168
@nikomiller6168 4 жыл бұрын
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.
@fuleswaripal9536
@fuleswaripal9536 4 жыл бұрын
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👍👍😁
@icewreck
@icewreck 3 жыл бұрын
Quick sort is generally in-place, and your implementation, while simple to understand, is isn't which means it would have a disastrous memory footprint for larger input sets.
@tai-shanlin615
@tai-shanlin615 4 жыл бұрын
this is the cleanest implementation of quicksort that I have seen. period. So easy to follow! Subscribed
@UnknownSend3r
@UnknownSend3r 3 жыл бұрын
100% it was clear and concise.
@riszard999
@riszard999 3 жыл бұрын
it's slower and has bigger memory complexity :)
@tursunalikholdorov1853
@tursunalikholdorov1853 3 жыл бұрын
@@riszard999 Do you know more efficient implementation?
@UnknownSend3r
@UnknownSend3r 3 жыл бұрын
@Leland Jon ofcourse we care that you hacked her account in 15 mins, Il be sure to use it once I've replied to that Nigerian prince that's been messaging me recently.
@waseemq1522
@waseemq1522 3 жыл бұрын
FRRR
@Sixthfred
@Sixthfred 4 жыл бұрын
Although it isn't in-place, your tutorial was very simple to understand and should definitely be how Quicksort ought to be taught!
@user-ze7sj4qy6q
@user-ze7sj4qy6q 3 жыл бұрын
just found this channel rn and this dude is so easy to understand and chill (but not boring) untapped resource of knowledge right here
@webknowledge9989
@webknowledge9989 2 жыл бұрын
this is the BEST explanation of quicksort, EVER.
@easynow6599
@easynow6599 2 жыл бұрын
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
@jesuisravi
@jesuisravi 3 жыл бұрын
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.
@temoork-0197
@temoork-0197 Ай бұрын
this is the best and easiest to understand quicksort implementation method ive seen
@sagarsonkar6961
@sagarsonkar6961 Жыл бұрын
Wtf man I'm literally stunned on how easy you made it.
@dikshyantauprety4020
@dikshyantauprety4020 3 жыл бұрын
The simplicity of this is divine..... Thank you so much
@anshimagarg9661
@anshimagarg9661 4 жыл бұрын
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 ❤️❤️
@pratikzajam799
@pratikzajam799 4 жыл бұрын
man ur amazing, understood first time quick sort in my life
@glorysonhorace3265
@glorysonhorace3265 3 жыл бұрын
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
@ezekieljoseph1668
@ezekieljoseph1668 Жыл бұрын
Thanks, you have no idea how much this helps.
@linneadahmen5962
@linneadahmen5962 3 жыл бұрын
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.
@UnrecycleRubdish
@UnrecycleRubdish 4 жыл бұрын
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.
@msh104utube
@msh104utube 3 жыл бұрын
Nothing beats the smell of clean code in the morning. Great job, very clean code.
@harry6183
@harry6183 2 ай бұрын
Most clear and straight explanation..... Thanks..... I just came across a one liner of quick sort in python.... Now I think I will be able to understand it. Thanks a lot!!
@fazilrahmanz9797
@fazilrahmanz9797 9 ай бұрын
I was like keep on looking into many youtube videos to find a perfect video for quick sort then landed over here and got the most easiest and understandable way to code it in python for the quick sort !!
@Isha-bq7up
@Isha-bq7up 3 күн бұрын
Most simply understanding video for any students, this video is so helpful as compare to another videos😊
@efrainflores3902
@efrainflores3902 Ай бұрын
This is one of the best and easiest implementations I have seen on this subject. Thank you. Subscribed
@chesslearn8103
@chesslearn8103 4 жыл бұрын
I have finally found a clear, well explain and simple answer to my questions. Ty very much.
@kamilosok4454
@kamilosok4454 3 жыл бұрын
You wrote this algorithm more clearly than anyone else I've seen
@user-ng4bc3cv6g
@user-ng4bc3cv6g 3 жыл бұрын
Thank you, I understood the algorithm in the first 2 minutes of the video.
@sud0gh0st
@sud0gh0st 3 жыл бұрын
You explained it perfectly in 6 minutes can't argue that this is content with value got my sub
@gabrielkondo5246
@gabrielkondo5246 6 ай бұрын
Bro, this is the best explanation and small and eficient code i've ever seen so far
@ayman6237
@ayman6237 4 жыл бұрын
This is the best, cleanest, efficient and the most beginner friendly quick sort algorithm i've stumbled upon. Thanks my man!
@soseofficial3923
@soseofficial3923 3 жыл бұрын
if i was rich i would have donated 10,000 dollars to you for this best explanation of quick sort. Thank you Derrick sherrill. God Bless you
@tasic29
@tasic29 Ай бұрын
This is the greatest explination of all time brother! Thank you!
@rob_dyy
@rob_dyy 4 жыл бұрын
This is one of the cleaner implementation of all the quicksort I've seen
@FaysalIshtiaq
@FaysalIshtiaq 4 жыл бұрын
Quicksort is an in-place sorting algorithm. It is supposed not to take any additional space.
@left_eyebr0w
@left_eyebr0w 4 жыл бұрын
any tips on how upgrade it ?
@DeadManProp
@DeadManProp 4 жыл бұрын
You're referring to a different version of quicksort. Not all quicksort algorithms are "in-place".
@sq6003
@sq6003 4 жыл бұрын
@@DeadManProp is this version recursive?
@alimul_nishat
@alimul_nishat Ай бұрын
You saved my day dude, Just watched the video once & I successfully ran the code, insane. Keep it up. Hats off 😇
@subhashreebehera2994
@subhashreebehera2994 4 жыл бұрын
I am a beginner in ds algo...after seeing another video thought of quiting as I couldn't understand properly but ur videos now made me wanting to learn more...how amazing explanations man🙏🙏
@samer820
@samer820 2 жыл бұрын
I have watched multiple quicksort videos and so far this is the best and the cleanest explanation I have seen so far 👍
@mohitshetty8535
@mohitshetty8535 2 жыл бұрын
You are making coding easier for me. Thank you.
@shrirajshakunt7203
@shrirajshakunt7203 3 жыл бұрын
Where were you, Derrick...you saved my life. best of best programming video so far.
@Nick-gs4em
@Nick-gs4em 2 жыл бұрын
Bro keep doing what you're doing I spent like an hour trying to understand quicksort, and the code to implement it, and I got it after 5 minutes of your video!
@engdoretto
@engdoretto 2 жыл бұрын
The best explanation I found on the internet… thanks a lot!
@girishkakumanu4117
@girishkakumanu4117 2 жыл бұрын
FANTASTIC TUTORIAL! I always thought quick sort was the hardest, but your video helped me learn it thoroughly. Tysm!
@pritam1366
@pritam1366 3 жыл бұрын
Man this is by far the best explanation, i wasted my time on so many videos. Thanks man
@user-ky2vl2wm3j
@user-ky2vl2wm3j 3 жыл бұрын
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.
@HamzaKhan-zj6dn
@HamzaKhan-zj6dn 9 ай бұрын
first time was able to understand this algo....loved it...
@bsdtux
@bsdtux 4 жыл бұрын
Agree with the comments below. I was trying to understand the implementation from "The Practice of Programming" but quickly got confused trying to reimplement their version from C to python. Watching your video breaking down the concepts I got it right away. Many thanks for this video
@srijitbhattacharya6770
@srijitbhattacharya6770 2 жыл бұрын
this is certainly one of your top drawer explanantions
@tingtingcheng6386
@tingtingcheng6386 Жыл бұрын
Amazing, after watching so many videos... I finally got it! so underrated tutorial
@benjaminbennington213
@benjaminbennington213 4 жыл бұрын
Wow that was amazingly simple. I learned this a while ago in college, but my teacher made it a 3 week process that was beyond confusing. That was so clean and simple. Great job. I immediately subscribed.
@mohammedumarfarhan9900
@mohammedumarfarhan9900 3 жыл бұрын
Man ur a freaking genius May God bless u abdundantly
@raweenweerakoon6086
@raweenweerakoon6086 2 жыл бұрын
Superb one ☝️ even our lecturer was unable to give complete idea and unable to gave a code like this simple. it was very complicated i gave it up then searched and fined this what an algorithm great keep your good work😊❤️
@turjo119
@turjo119 4 жыл бұрын
My God I've been searching for hours for an easy coding solution to follow. Your vid literally saved me! Thank you so much
@arunnp7348
@arunnp7348 2 жыл бұрын
Excellent explanation...I went through multiple videos about quick sorting & Hands down , this one is the best !!
@PeizhiYan
@PeizhiYan Жыл бұрын
Absolute amazing! Your tutorial is the best and most understandable I have ever watched!
@Cpt.C
@Cpt.C Жыл бұрын
This implementation is also good. def quick_sort(arr): if len(arr) pivot] return quick_sort(left) + middle + quick_sort(right)
@sakshiwahi2025
@sakshiwahi2025 3 жыл бұрын
WHOA 🤯🤯 HOW COULD YOU MAKE IT SO EASY TO UNDERSTAND !!!!!
@arielm7248
@arielm7248 4 жыл бұрын
Amazing explanation!!!!!!!! Much better than what my TA's and Prof did in a whole week.. you did it in 6 minutes!!!! Thank you~~
@wissammoussa7540
@wissammoussa7540 4 жыл бұрын
oh my god man thank you!!! I wasted my afternoon watching quicksort animations and I finally understand it
@helikopter1231
@helikopter1231 2 жыл бұрын
This pythin solution was soooooo much easier to understand! Thank you!
@gautamacharekar
@gautamacharekar 4 жыл бұрын
Hi Derrick, Thanks for wonderful and simple explanation of the quick sort algorithms. Never understood the quick sort much better. Could you also please explain time and space complexity of the algo that you explain. Then it would be more clear to understand advantage of one over other. Thanks again
@MariaAllstar
@MariaAllstar 3 жыл бұрын
Hi, Derrick! Thanks for your explanation, it was very helpful :) Anyway I found a small bug in your implementation. As you `pop()` to extract the pivot from the list, the values from the original list are modified. This causes that if the input array is already sorted you loose the pivot, which is your case is the last position. For a real code example of the situation, look at the following assertion: `quick_sort([1, 2, 3, 4, 5, 6, 7]) == [1, 2, 3, 4, 5, 6]` (note that the 7 is missing). This can be solved by using an operation that does not affect the original variable outside of the function's scope, like this two line version of pop: ``` pivot = sequence[-1] sequence = sequence[:-1] ``` Regards!
@belhaddadmohamed7
@belhaddadmohamed7 Жыл бұрын
Hi, Maria i don't find any error the output will be: [1, 2, 3, 4, 5, 6, 7] the value of the pivot is already stored in pivot variable thank you,
@pragyantiwari3885
@pragyantiwari3885 Жыл бұрын
Derrick already restored the pivot value at the end return statement....so the code works right . And Even I am not having problem with it
@nehalzaman1159
@nehalzaman1159 2 жыл бұрын
Thanks sir! I have seen various implementations of quick sort that literally made no sense to me, until I saw your explanation. That is really an awesome implementation. If I say thanks 100 times, that would still not enough. Keep up the good work, sir!
@Knut_Eisbaer
@Knut_Eisbaer Жыл бұрын
That was an incredible explanation, man. That's pure elegance.
@nappdaddy2000
@nappdaddy2000 4 жыл бұрын
just finished mosh's python course...was interested in algorithms for sorting and graphing(searching)... Great video, well explained, thanks mate!
@davidle8881
@davidle8881 4 жыл бұрын
I don't normally comment on the video. This is by far an easier explanation to quicksort.
@shiv4667
@shiv4667 3 жыл бұрын
Was thinking of making a sorting visualiser project. Now I can code this in JavaScript for sure. Thanks man!
@054siddarth3
@054siddarth3 3 жыл бұрын
Oh my god! this is the best and easiest solution of quicksort, thank you so much.
@alwayssporty8102
@alwayssporty8102 3 жыл бұрын
best quicksort video on this planet thanks bro
@roubarizkallah2172
@roubarizkallah2172 3 жыл бұрын
Strongly recommend this video for beginners. Cute guy and great teacher, what else would u ask for XD. More seriously now, short video with good editing going straight to the point and explaining this concept in a simple way. Thank you man, keep it up.
@DeadManProp
@DeadManProp 4 жыл бұрын
for i in range(1, infinity): print("THANK YOU!!")
@grishakek
@grishakek 4 жыл бұрын
while True: print("this is better")
@halfword
@halfword 4 жыл бұрын
DeadManProp amazing
@Cartouchai
@Cartouchai 4 жыл бұрын
@Nishad Joshi lol recursion is the best 1
@Cartouchai
@Cartouchai 4 жыл бұрын
@Nishad Joshi jks stack overflow
@hemantkosrekar3309
@hemantkosrekar3309 3 жыл бұрын
How he choose pivot = sequence.pop() It returns additional character y 🤔?
@lokeshnaidu1935
@lokeshnaidu1935 3 жыл бұрын
Ohhhhhh your code logic simplicity is really awesome derrick
@shreehari2589
@shreehari2589 3 жыл бұрын
This gotta be the awesomest explanation about quick sort, great job Derrick keep up the good work, i hope to see more data structures and algorithms tutorials from you!!!
@ziqizhang1925
@ziqizhang1925 Ай бұрын
The most clear video. Helps a lot!
@edwinjonah
@edwinjonah 3 жыл бұрын
Wow, it looked so complicated and you just made it simple! Amazing, thanks a lot.
@souvikguria1414
@souvikguria1414 4 жыл бұрын
after going over 4-5 paid rock hard explanations I found your channel....liked, shared, subscribed faster than any sorting algorithm :P
@tareqmahmud3902
@tareqmahmud3902 3 жыл бұрын
you ar ethe best-est teacher I can ever imagine...thank you ...!
@mayankbaber9384
@mayankbaber9384 2 жыл бұрын
I've my university prac exam tomorrow and U JUST FU*KING NAILED IT MAN!!!!!! YEAH, U ALSO EARNED A SUB!!!!
@richcs8287
@richcs8287 3 жыл бұрын
Hi Derrick, Thanks for wonderful and simple explanation of the quick sort algorithms. Never understood the quick sort much better.
@ZinduZatism
@ZinduZatism 4 жыл бұрын
U R D Man, many thanks, others explain logarithm over half hour and still struggle to understand, urs short, clear and easy thank you subscribed. please make video of merge sort as well if possible. thank you
@nokibulislam9423
@nokibulislam9423 4 жыл бұрын
this is the most underrated channel i have ever seen .Keep up the good work man
@abhinabamajumder4818
@abhinabamajumder4818 5 жыл бұрын
Thank you so much specially for simplifying it to such an extent. Artistic elegance!
@SuperMixGamer
@SuperMixGamer Жыл бұрын
thank you very much, this was the best implementation i could find and the easier to understand
@robertue1
@robertue1 2 жыл бұрын
Great, really simple and easy to follow explanation, thanks Derrick.
@shangliu6687
@shangliu6687 4 жыл бұрын
The best video for quick sort explanation!!! Clean and clear! theoretical and practical!
@nitroflap
@nitroflap 4 жыл бұрын
Thanks a lot. I've been searching for something like this. And I've found this video. It helped me create algorithm from scratch and understand it. Thank uuuu!
@RobsondaMota
@RobsondaMota Жыл бұрын
Thank you for your concise and easy to understand implementation Derrick. Very good videos. Thanks!
@HungNguyen-pr5ci
@HungNguyen-pr5ci 3 жыл бұрын
I am understanding this video as quickly as quick sort
@lanog40
@lanog40 2 жыл бұрын
Thanks for the tutorial! I kept looking up how quick sort works, but I felt that assigning each partition to a new array would cause memory issues. My list of over 1000 floats seems to sort quite well :)
@armberg8935
@armberg8935 4 жыл бұрын
this channel is amazing, had trouble understanding my lecturer but this was super clear!
@abhishekbhardwaj7214
@abhishekbhardwaj7214 4 жыл бұрын
Thanks for making it a piece of cake man, cheers.
@miguelmarques6233
@miguelmarques6233 3 жыл бұрын
Such a good and simple way of explaining quick sort! Thank you for sharing!!
@stevehoang9
@stevehoang9 2 жыл бұрын
Thank you for your explanation. It's super clear and easy to understand!
@albertgracelieu1506
@albertgracelieu1506 4 жыл бұрын
It's clearly explained. But there is a tiny mistake in "pivot = sequence.pop()", which is an in-place mutation, and would change your input data by removing the only the last element. This is unexpected and causes trouble when the input data is used again elsewhere. It can easily be corrected by "pivot = sequence[-1]; for item in sequence[:-1]:"
@navneet3211
@navneet3211 3 жыл бұрын
I understand pivot in 1st attempt,..thanks bro
@dharineeshkarthikeyan1868
@dharineeshkarthikeyan1868 5 жыл бұрын
Thanks so much ..really helped me understand quick sort much better and in such a easy way
@stillbald5827
@stillbald5827 4 жыл бұрын
Thank you! This was super clear and helpful. Would love to see a follow up where you talk about different ways to optimize this.
@wanou_4259
@wanou_4259 2 жыл бұрын
recursive function i see, pretty clever although not that efficient with much more values, it is still pretty impressive to see that's quite simple
@gedeonnokbak760
@gedeonnokbak760 7 ай бұрын
awesome bro, very helpful to understand quick sort behind the scene. marvelous. But if the space complexity matter the most, we could struggle with your algorithm, since quick sort should be an in-place algo. But this is the best intuitive explanation of quick sort I have ever seen. Awesome
25 nooby Python habits you need to ditch
9:12
mCoding
Рет қаралды 1,8 МЛН
Twin Telepathy Challenge!
00:23
Stokes Twins
Рет қаралды 96 МЛН
2.8.1  QuickSort Algorithm
13:43
Abdul Bari
Рет қаралды 3,3 МЛН
15 Python Projects in Under 15 Minutes (Code Included)
12:37
Tech With Tim
Рет қаралды 2 МЛН
Quicksort Algorithm: A Step-by-Step Visualization
9:32
Quoc Dat Phung
Рет қаралды 67 М.
Quicksort In Python Explained (With Example And Code)
14:13
FelixTechTips
Рет қаралды 157 М.
11 Tips And Tricks To Write Better Python Code
11:00
Patrick Loeber
Рет қаралды 619 М.
Learn Quick Sort in 13 minutes ⚡
13:49
Bro Code
Рет қаралды 389 М.
Мучительная смерть  HUAWEI Mate XT
0:58
Кик Обзор
Рет қаралды 4,1 МЛН