It's been two hours searching for a decent quicksort explanation and came across this great video, consider taking the path of the teacher if you are not already into it. Much love
@QuocDatPhung10 ай бұрын
Thanks a lot Lucazama! You can find all of my CS videos like Quick Sort in the following link (don't forget to share with others and kindly subscribe!): kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@LUCAZAMA-or2dt9 ай бұрын
@@QuocDatPhung do not worry about it, i have already done all of that
@QuocDatPhung9 ай бұрын
@@LUCAZAMA-or2dt Thanks so much!
@jeremysmelley7143 Жыл бұрын
This is definitely top 2 quicksort videos i've watched. Highly underrated, this helped a lot, thanks!
@QuocDatPhung Жыл бұрын
Thanks Jeremy! Please kindly subscribe and share! You can find all of my Data Structure videos here: kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@AliCrown26 күн бұрын
Which one is the other one?
@ConorLambert6 ай бұрын
Absolute best video on Quicksort. I was looking at other vids from people with millions of subscribers and nowhere near as good as this. Thank you my good friend.
@QuocDatPhung6 ай бұрын
Thank you for your kind words Conor! Please kindly share with your friends and subscribe to support me ~ also you can find all of my CS videos in this link: kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@mm-en1rf9 ай бұрын
I appreciate the video greatly, I went through 2 other quicksort videos and this was the only one of the three which I could easily comprehend. I'll be sure to visit your other videos when it comes to understanding more comp sci content !!
@QuocDatPhung9 ай бұрын
Hey there I'm really glad you found it helpful! You can find all of my CS videos in the link below (don't forget so share with your classmates to help them too!) kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@oshawastaken Жыл бұрын
This is by far the best explanation of quicksort on yt, thank you!
@QuocDatPhung Жыл бұрын
Thanks so much! Please kindly also check out my Merge Sort video: kzbin.info/www/bejne/nqCTZpidpsiDopY
@Bromon65510 ай бұрын
I watched a lot of quicksort videos and this was the first one that clicked with me. Well done
@QuocDatPhung10 ай бұрын
Thanks a lot Bromon! You can find my other CS videos in this playlist: kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@BubsGirl2914 ай бұрын
My prof attempted to explain quick sort in class to us and I left very confused. This was so clear and easy to understand, thank you for helping it click in my brain! Kudos to you sir!
@QuocDatPhung4 ай бұрын
Thank you BubsGirl! I'm glad you like my explanation! If you know anyone who needs help with this class, kindly share it with them and also subscribe to support me (it means a lot) ~ you can find all of my CS videos in this link: kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@KnochenMarkSaege11 ай бұрын
I've watched a few videos on this topic, and this one helped me personally the most, by far. Thank you for taking the time to explain in detail every step that is necessary to achieve the wanted effect. Also, explaining how the code behind it works really helped me grasp the concept. Thank you very much for your effort :)
@QuocDatPhung11 ай бұрын
Thanks so much KnochenMarkSaege! I'm really happy that you found my video useful! I have an entire playlist on Algorithms; you might also like my 3 min Merge Sort explanation: kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@ethanaustin_176 ай бұрын
After watching a bunch of videos I finally came across one that I understood!
@QuocDatPhung6 ай бұрын
Thank you Ethan! Please kindly share with your friends and subscribe to support me (it means a lot) ~ you can find all of my CS videos in this link: kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@g.r.43727 ай бұрын
I was 100% from beginning to end. You're a great teacher.
@QuocDatPhung7 ай бұрын
Thank you G.R! Please kindly share and subscribe~ you can find all of my CS videos in this link: kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@Developer-s6f5 ай бұрын
Very clear and correct explanation. Thank you so much for making an effort to explain this the correct way!
@QuocDatPhung5 ай бұрын
Thank you! Please kindly share with your friends and subscribe to support me (it means a lot) ~ you can find all of my CS videos in this link: kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@InfinityOver0Ай бұрын
Subscribed. Brilliant video. I will again go over it again tomorrow in the morning, take notes and understand quicksort once and for all. Thank you Quoc Dat Phung, your explanation is brilliant.
@MariusCiutea7 ай бұрын
I can't believe how well explained this is! And I'll never understand why college professors seem incapable of explaining in such an easy to understand manner.
@QuocDatPhung7 ай бұрын
Thank you for your kind words Marius! Please kindly share and subscribe~ all of my CS videos are in this link: kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@khoadoan89668 ай бұрын
Bro, you're amazing, explaining the complex processes so easily. Haven't touched DSA for a long time, and then having to learn it all over again after being laid off is really hard for me as I'm not as young. You've just helped me understand fuzzy complex knowledge really really well. Thank you !
@QuocDatPhung8 ай бұрын
Thank you Khoa! I'm really happy to hear that! Pleased kindly share ~ you can find all of my CS videos in this link: kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@khoadoan89668 ай бұрын
@@QuocDatPhungI’ll share it, and have a look at your playlist. Really appreciate your contents.
@AliCrown3 ай бұрын
Best video ever! I was just watching those videos that have millions of views, and I didn't get the point of this algorithm, but after this video, finally, I got off the struggle of a week.
@QuocDatPhung3 ай бұрын
Thank you so much Ali! I'm glad you like my explanation! If you know anyone who needs help with this topic, kindly share it with them and also subscribe to support me (it means a lot) ~ you can find all of my CS videos in this link: kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@harrygray9887 Жыл бұрын
outstanding work amigo. I was expecting thousands of comments.
@QuocDatPhung Жыл бұрын
Thank you so much Harry! Please kindly subscribe and share with your classmates. It really means a lot. Also, if you like my Quicksort video, you might also like my 4 min Merge sort video: kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@abramweigant24385 ай бұрын
I never leave comments, but this video was incredible; good job, man!
@QuocDatPhung5 ай бұрын
Thank you AbramWeigant! Please kindly share with your friends and subscribe to support me (it means a lot) ~ you can find all of my CS videos in this link: kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@strawberriesandcream2863 Жыл бұрын
best quicksort video i've watched that helped me clarify the concept :) thanks!
@QuocDatPhung Жыл бұрын
Thanks so much Strawberries! I think you'll like my Merge Sort animation too! Please check it out here: kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@lowe737211 ай бұрын
Best explanation, and best mindset to approach the algorithm. The game example is AWESOME. Thank you very much! please do more
@QuocDatPhung11 ай бұрын
Thank you very much! I have an entire playlist of my Algorithms; I hope you'd enjoy my Merge Sort video as well: kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@annarankin91035 ай бұрын
Thank you Quoc, this video has been very helpful.
@QuocDatPhung5 ай бұрын
Thank you Anna! Please kindly share with your friends (it means a lot) ~ you can find all of my CS videos in this link: kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@LizyAd3 ай бұрын
Searching for a good video on quick sort has been difficult but this is very good. Thanks
@QuocDatPhung3 ай бұрын
Thank you Lizy! I'm glad you like my explanation! If you know anyone who needs help with this topic, please kindly share it with them and also subscribe to support me (it means a lot) ~ you can find all of my CS videos in this link: kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@anooshiepooshie4 ай бұрын
I love you bro. Everything made sense.
@QuocDatPhung3 ай бұрын
Thank you Anooshiepooshie! I'm glad you like my explanation! If you know anyone who needs help with this class, kindly share it with them and also subscribe to support me (it means a lot) ~ you can find all of my CS videos in this link: kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@JacobChencha6 ай бұрын
That was a beautiful explanation!
@QuocDatPhung6 ай бұрын
Thank you Jacob! Please kindly share with your friends and subscribe to support me ~ you can find all of my CS videos in this link: kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@FilhosdeAdao110 ай бұрын
Thank you. Best explanation
@QuocDatPhung10 ай бұрын
You're welcome! You can find all of my CS videos in this playlist (don't forget to share and kindly subscribe!): kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@stormShadow647 ай бұрын
awesome video, very clear
@QuocDatPhung7 ай бұрын
Thank you! Pleased kindly share and subscribe~ you can find all of my CS videos in this link: kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@st-lucia Жыл бұрын
Thank you!
@QuocDatPhung Жыл бұрын
Thanks so much, St-Lucia - Castria La Patria! Please kindly subscribe! You can find the rest of my Algorithms videos here: kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@romanvolosiuk3919 Жыл бұрын
It really helped me. Thanks!
@QuocDatPhung Жыл бұрын
You're very welcome Roman Volosiuk! Please kindly subscribe! You can also find the rest of my Algorithms videos in this playlist: kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@EnjoyerOfBepis2 ай бұрын
I don't understand why the worst case is O(N^2). When we move LEFT and RIGHT until they cross each over, we do RIGHT - LEFT operations which is equal to the length of our subarray. And we do it twice for both parts (left subarray and right subarray). For example, let's sort an array of length 100. In the first call of our partition func, we do 100 iterations. Then we split it into two subarrays and call partition func on both of them, which gives us 50 + 50 iterations. Then again and again. Total number of iterations: 100; 50 + 50; (25 + 25) + (25 + 25); ((12 + 12) + (12 + 12)) + ((12 + 12) + (12 + 12)); (((6 + 6) + (6 + 6)) + ((6 + 6) + (6 + 6))) + (((6 + 6) + (6 + 6)) + ((6 + 6) + (6 + 6))); (((((3 + 3) + (3 + 3)) + ((3 + 3) + (3 + 3))) + (((3 + 3) + (3 + 3)) + ((3 + 3) + (3 + 3))))) + (((((3 + 3) + (3 + 3)) + ((3 + 3) + (3 + 3))) + (((3 + 3) + (3 + 3)) + ((3 + 3) + (3 + 3))))); ((((((1 + 1) + (1 + 1)... and so on Sum of every row it gives us about ~650 iterations. Calculation are very silly and simple, but the time complexcity seems always O(N*logN) for me, not O(N^2). O(N*logN): 100 * 10 = 1000 O(N^2): 100 * 100 = 10000 ~650 is closer to 1000. Where am I wrong?
@QuocDatPhung2 ай бұрын
I know what you mean. In Computer Science sometimes you have to look at the proof of Quick Sort where they do a lot of math and get O(n^2). I remember when Iearn algorithms like Djkstra's and the run time is very unintuitive. The math in the proof is what determines it. After the Data Structures course, you'll likely be taking Analysis of Algorithms where they'll talk more about it. But for now just know Quicksort is O(n^2)
@EnjoyerOfBepisАй бұрын
@@QuocDatPhung Yeah, thank you for the answer. I found my mistake. The worst case when we divide an array not to 50 + 50, but 99 + 1. Then 98 + 1. Then 97 + 1. So total number of operations is 100 + 99 + 98 + 97 + ... + 3 + 2 + 1, which can be simplified to 100 + (99 + 1) + (98 + 2) + (97 + 3) + ... + 50 = 100 * 50 + 50 = 5050 operations. So it's closer to O(N^2).
@QuocDatPhungАй бұрын
@@EnjoyerOfBepis That's awesome! If you know anyone who needs help with this topic, please kindly share it with them and also subscribe to support me (it means a lot) ~ you can find all of my CS videos in this link: kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@EnjoyerOfBepisАй бұрын
@@QuocDatPhung Sure I'll do! Many thanks for your channel, it's extra helpful!
@Harshavardhan-pk3pk8 ай бұрын
good explaination must watch
@QuocDatPhung8 ай бұрын
Thank you! Pleased kindly share and subscribe~ you can find all of my CS videos in this link: kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@TungNguyen-oi4xo Жыл бұрын
cảm ơn e, giảng rất dễ hiểu
@QuocDatPhung Жыл бұрын
Cám ơn anh! Em có làm clip về Merge Sort và các algorithms khác ở đây nè: kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@samuraijosh159510 ай бұрын
Hey thanks for the video, quick and to the point with nice visuals but how is space complexity O(log n)???
@QuocDatPhung10 ай бұрын
You're very welcome Doremon! The space complexity depends of where you choose the pivot. I wouldn't worry too much about it. You can find all of my CS videos in this playlist below (don't forget to share and kindly subscribe!): kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@samuraijosh159510 ай бұрын
@@QuocDatPhung never mind I learnt that it was the stack space, log n function calls in the stack. Since quick sort is hyped up as in place sorting, I just assume constant space. Tbf, I've seen leetcode questions where it was advised to just ignore the recursion function stack space and treat the whole thing as if it was constant space. A bit inconsistent...
@QuocDatPhung10 ай бұрын
@@samuraijosh1595 Thanks for letting me know!
@phoenixkomben-ie9xq8 ай бұрын
Great video
@QuocDatPhung8 ай бұрын
Thank you Phoenix! I think you'll like my other Sort videos too! Don't forget to share with your classmates and kindly subscribe ~ you can find all of my CS videos in this link: kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@hoteny3 ай бұрын
Why do you continue when L
@QuocDatPhung3 ай бұрын
If you stop when they are equal, quicksort will not be able to handle duplicates in the array. For example, let's say the array is [4, 3, 5, 5, 5, 2, 1]. If your pivot is 5 and you stop the partitioning process at L
@anantha32635 ай бұрын
Hi sir, why we need to swap array L and R with the same index? both already the same value.. Thanks
@QuocDatPhung5 ай бұрын
The algorithm will still swap them even though they are the same :)
@awieeeee Жыл бұрын
hello, what if the mid index results in a decimal value? what number should i choose? the values are (5,1,8,4,3,9,6,2), so mid index: m = 0 + 7 / 2 = 7/2 or 3.5 where should the pivot be placed?
@QuocDatPhung Жыл бұрын
The formula for calculating mid at 0:25 has the floor sign (meaning to round down). So if m =3.5, we simply round down to 3. Let me know if that makes sense! You may also like my Merge Sort video :)
@aleareyatol4 ай бұрын
How about if there is a 9 elements, is it still the same process?
@QuocDatPhung4 ай бұрын
Yes, the process will be the same
@naza2105 Жыл бұрын
trank you so much
@QuocDatPhung Жыл бұрын
You're welcome Naza! Please kindly subscribe if you enjoyed! Also, you can find all of my Algorithms videos here: kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@coryanders632811 ай бұрын
easily the best video i've seen on this. all the other ones give very poor, if any, explanation as to what they are doing
@QuocDatPhung11 ай бұрын
Thanks so much Coryanders! You'll probably like my 3min Merge Sort video as well: kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@samirpandit88996 ай бұрын
the goattt
@QuocDatPhung5 ай бұрын
Thank you SamirPandit! Please kindly share with your friends and subscribe to support me (it means a lot) ~ you can find all of my CS videos in this link: kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@yaelw5986 Жыл бұрын
does this method use hoare's partitioning
@QuocDatPhung Жыл бұрын
No I don't think so. I hope you enjoy this video! If you do, you might also like my Merge Sort video too: kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@thuhuynh747410 ай бұрын
Anh nhìn xịn quáaaa
@QuocDatPhung10 ай бұрын
Hehe cám ơn em! Tất cả clip máy tính của anh nằm trong link sau đây (em đừng quên chia sẻ và đăng kí ủng hộ anh nhé!): kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@hasanshahriarboni7957 Жыл бұрын
❤
@QuocDatPhung Жыл бұрын
Thanks very much Hasan! I hope you will also enjoy my Merge Sort video: kzbin.info/www/bejne/nqCTZpidpsiDopY
@prashantnegi68319 ай бұрын
can anybody reply with python code for this?
@prashantnegi68319 ай бұрын
don't worry, wrote it in java with the help from your python code, thanks
@QuocDatPhung9 ай бұрын
You're very welcome! You can find all of my CS videos in the link below (don't forget to share with your classmates!): kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@amazekhashaa73093 ай бұрын
How did you maintain happiness in your face long time
@QuocDatPhung3 ай бұрын
Haha I enjoy the process of making videos :) You can find all of my CS videos in this link: kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC