Quicksort Algorithm: A Step-by-Step Visualization

  Рет қаралды 52,748

Quoc Dat Phung

Quoc Dat Phung

Күн бұрын

In this video, we will take a closer look at the Quicksort Algorithm and its implementation. We will start by explaining the basic concepts behind the algorithm, such as the pivot element, partitioning, and recursion. We will then walk through a step-by-step example to illustrate how the algorithm works through a step by step visualization.
Quicksort Algorithm is one of the most widely used and efficient sorting algorithms in computer science. I will show you how to sort an array from least to greatest. It is a divide-and-conquer algorithm that recursively partitions an array or list of elements into smaller sub-arrays, and then sorts these sub-arrays in place. You also need to select a pivot, and for this video we always pick the middle index. The algorithm was first developed by Tony Hoare in 1959 and has since been optimized and improved upon by many researchers.
Additionally, we will cover some of the key features of Quicksort, such as its ability to handle large data sets and its performance characteristics. We will also discuss some of the potential pitfalls and limitations of the algorithm.
By the end of this video, you will have a solid understanding of how the Quicksort Algorithm works and how it can be used to efficiently sort data. Whether you are a beginner or an experienced programmer, this video is sure to provide valuable insights into this essential sorting algorithm

Пікірлер: 77
@LUCAZAMA-or2dt
@LUCAZAMA-or2dt 6 ай бұрын
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
@QuocDatPhung
@QuocDatPhung 6 ай бұрын
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-or2dt
@LUCAZAMA-or2dt 5 ай бұрын
@@QuocDatPhung do not worry about it, i have already done all of that
@QuocDatPhung
@QuocDatPhung 5 ай бұрын
@@LUCAZAMA-or2dt Thanks so much!
@ConorLambert
@ConorLambert 2 ай бұрын
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.
@QuocDatPhung
@QuocDatPhung 2 ай бұрын
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
@ethanaustin_17
@ethanaustin_17 2 ай бұрын
After watching a bunch of videos I finally came across one that I understood!
@QuocDatPhung
@QuocDatPhung 2 ай бұрын
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
@jeremysmelley7143
@jeremysmelley7143 11 ай бұрын
This is definitely top 2 quicksort videos i've watched. Highly underrated, this helped a lot, thanks!
@QuocDatPhung
@QuocDatPhung 11 ай бұрын
Thanks Jeremy! Please kindly subscribe and share! You can find all of my Data Structure videos here: kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@g.r.4372
@g.r.4372 3 ай бұрын
I was 100% from beginning to end. You're a great teacher.
@QuocDatPhung
@QuocDatPhung 3 ай бұрын
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
@oshawastaken
@oshawastaken 9 ай бұрын
This is by far the best explanation of quicksort on yt, thank you!
@QuocDatPhung
@QuocDatPhung 9 ай бұрын
Thanks so much! Please kindly also check out my Merge Sort video: kzbin.info/www/bejne/nqCTZpidpsiDopY
@MariusCiutea
@MariusCiutea 2 ай бұрын
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.
@QuocDatPhung
@QuocDatPhung 2 ай бұрын
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
@Developer-s6f
@Developer-s6f Ай бұрын
Very clear and correct explanation. Thank you so much for making an effort to explain this the correct way!
@QuocDatPhung
@QuocDatPhung 22 күн бұрын
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
@Bromon655
@Bromon655 6 ай бұрын
I watched a lot of quicksort videos and this was the first one that clicked with me. Well done
@QuocDatPhung
@QuocDatPhung 6 ай бұрын
Thanks a lot Bromon! You can find my other CS videos in this playlist: kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@KnochenMarkSaege
@KnochenMarkSaege 7 ай бұрын
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 :)
@QuocDatPhung
@QuocDatPhung 7 ай бұрын
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
@harrygray9887
@harrygray9887 11 ай бұрын
outstanding work amigo. I was expecting thousands of comments.
@QuocDatPhung
@QuocDatPhung 11 ай бұрын
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
@khoadoan8966
@khoadoan8966 3 ай бұрын
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 !
@QuocDatPhung
@QuocDatPhung 3 ай бұрын
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
@khoadoan8966
@khoadoan8966 3 ай бұрын
@@QuocDatPhungI’ll share it, and have a look at your playlist. Really appreciate your contents.
@abramweigant2438
@abramweigant2438 Ай бұрын
I never leave comments, but this video was incredible; good job, man!
@QuocDatPhung
@QuocDatPhung 22 күн бұрын
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
@mm-en1rf
@mm-en1rf 5 ай бұрын
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 !!
@QuocDatPhung
@QuocDatPhung 5 ай бұрын
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
@strawberriesandcream2863
@strawberriesandcream2863 11 ай бұрын
best quicksort video i've watched that helped me clarify the concept :) thanks!
@QuocDatPhung
@QuocDatPhung 11 ай бұрын
Thanks so much Strawberries! I think you'll like my Merge Sort animation too! Please check it out here: kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@annarankin9103
@annarankin9103 27 күн бұрын
Thank you Quoc, this video has been very helpful.
@QuocDatPhung
@QuocDatPhung 22 күн бұрын
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
@st-lucia
@st-lucia Жыл бұрын
Thank you!
@QuocDatPhung
@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
@JacobChencha
@JacobChencha 2 ай бұрын
That was a beautiful explanation!
@QuocDatPhung
@QuocDatPhung 2 ай бұрын
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
@lowe7372
@lowe7372 7 ай бұрын
Best explanation, and best mindset to approach the algorithm. The game example is AWESOME. Thank you very much! please do more
@QuocDatPhung
@QuocDatPhung 7 ай бұрын
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
@NucEstFemicomunismo
@NucEstFemicomunismo 6 ай бұрын
Thank you. Best explanation
@QuocDatPhung
@QuocDatPhung 6 ай бұрын
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
@stormShadow64
@stormShadow64 3 ай бұрын
awesome video, very clear
@QuocDatPhung
@QuocDatPhung 3 ай бұрын
Thank you! Pleased kindly share and subscribe~ you can find all of my CS videos in this link: kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@romanvolosiuk3919
@romanvolosiuk3919 9 ай бұрын
It really helped me. Thanks!
@QuocDatPhung
@QuocDatPhung 9 ай бұрын
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
@ananthaprasetya3263
@ananthaprasetya3263 Ай бұрын
Hi sir, why we need to swap array L and R with the same index? both already the same value.. Thanks
@QuocDatPhung
@QuocDatPhung 22 күн бұрын
The algorithm will still swap them even though they are the same :)
@Harshavardhan-pk3pk
@Harshavardhan-pk3pk 3 ай бұрын
good explaination must watch
@QuocDatPhung
@QuocDatPhung 3 ай бұрын
Thank you! Pleased kindly share and subscribe~ you can find all of my CS videos in this link: kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@awieeeee
@awieeeee 9 ай бұрын
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
@QuocDatPhung 9 ай бұрын
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 :)
@samuraijosh1595
@samuraijosh1595 5 ай бұрын
Hey thanks for the video, quick and to the point with nice visuals but how is space complexity O(log n)???
@QuocDatPhung
@QuocDatPhung 5 ай бұрын
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
@samuraijosh1595
@samuraijosh1595 5 ай бұрын
@@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...
@QuocDatPhung
@QuocDatPhung 5 ай бұрын
@@samuraijosh1595 Thanks for letting me know!
@phoenixkomben-ie9xq
@phoenixkomben-ie9xq 4 ай бұрын
Great video
@QuocDatPhung
@QuocDatPhung 4 ай бұрын
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
@TungNguyen-oi4xo
@TungNguyen-oi4xo 8 ай бұрын
cảm ơn e, giảng rất dễ hiểu
@QuocDatPhung
@QuocDatPhung 8 ай бұрын
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
@BubsGirl291
@BubsGirl291 Сағат бұрын
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!
@naza2105
@naza2105 8 ай бұрын
trank you so much
@QuocDatPhung
@QuocDatPhung 8 ай бұрын
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
@coryanders6328
@coryanders6328 7 ай бұрын
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
@QuocDatPhung
@QuocDatPhung 7 ай бұрын
Thanks so much Coryanders! You'll probably like my 3min Merge Sort video as well: kzbin.info/aero/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC
@yaelw5986
@yaelw5986 9 ай бұрын
does this method use hoare's partitioning
@QuocDatPhung
@QuocDatPhung 9 ай бұрын
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
@hasanshahriarboni7957
@hasanshahriarboni7957 10 ай бұрын
@QuocDatPhung
@QuocDatPhung 10 ай бұрын
Thanks very much Hasan! I hope you will also enjoy my Merge Sort video: kzbin.info/www/bejne/nqCTZpidpsiDopY
@samirpandit8899
@samirpandit8899 Ай бұрын
the goattt
@QuocDatPhung
@QuocDatPhung Ай бұрын
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
@thuhuynh7474
@thuhuynh7474 6 ай бұрын
Anh nhìn xịn quáaaa
@QuocDatPhung
@QuocDatPhung 6 ай бұрын
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
@prashantnegi6831
@prashantnegi6831 5 ай бұрын
can anybody reply with python code for this?
@prashantnegi6831
@prashantnegi6831 5 ай бұрын
don't worry, wrote it in java with the help from your python code, thanks
@QuocDatPhung
@QuocDatPhung 5 ай бұрын
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
Merge Sort Algorithm: A Step-by-Step Visualization
3:29
Quoc Dat Phung
Рет қаралды 6 М.
Simulating quicksort with last element as pivot
5:15
Nunung Nurul Qomariyah
Рет қаралды 1,5 М.
Inside Out 2: BABY JOY VS SHIN SONIC 3
00:19
AnythingAlexia
Рет қаралды 7 МЛН
АЗАРТНИК 4 |СЕЗОН 3 Серия
30:50
Inter Production
Рет қаралды 1 МЛН
Brawl Stars Edit😈📕
00:15
Kan Andrey
Рет қаралды 53 МЛН
HAH Chaos in the Bathroom 🚽✨ Smart Tools for the Throne 😜
00:49
123 GO! Kevin
Рет қаралды 14 МЛН
Learn Quick Sort in 13 minutes ⚡
13:49
Bro Code
Рет қаралды 341 М.
Quicksort: Partitioning an array
4:48
KC Ang
Рет қаралды 583 М.
Strings in C++
14:16
Dr. Michael Miljanovic
Рет қаралды 19
2.8.1  QuickSort Algorithm
13:43
Abdul Bari
Рет қаралды 3,2 МЛН
The Quicksort Sorting Algorithm: Pick A Pivot, Partition, & Recurse
26:31
Back To Back SWE
Рет қаралды 164 М.
8 patterns to solve 80% Leetcode problems
7:30
Sahil & Sarra
Рет қаралды 370 М.
Heap sort in 4 minutes
4:13
Michael Sambol
Рет қаралды 1 МЛН
Quicksort In Python Explained (With Example And Code)
14:13
FelixTechTips
Рет қаралды 147 М.
Quicksort algorithm
20:39
mycodeschool
Рет қаралды 1,8 МЛН
Inside Out 2: BABY JOY VS SHIN SONIC 3
00:19
AnythingAlexia
Рет қаралды 7 МЛН