Learn Quick Sort in 13 minutes ⚡

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 พ.ค. 2024
  • Quick sort data structures and algorithms tutorial example explained
    #quick #sort #algorithm
    00:00:00 explanation
    00:05:00 demonstration
    00:07:47 code
    // quick sort = moves smaller elements to left of a pivot.
    // recursively divide array in 2 partitions
    // run-time complexity = Best case O(n log(n))
    // Average case O(n log(n))
    // Worst case O(n^2) if already sorted
    // space complexity = O(log(n)) due to recursion
    music credits 🎼:
    ===========================================================
    Title: A Caring Friend
    Artist: Bad Snacks
    Link: • bad snacks: TH-cam Au...
    ===========================================================
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 259

  • @BroCodez
    @BroCodez  2 ปีที่แล้ว +442

    This was the most difficult video I've ever made
    It almost convinced me to quit coding tutorials 😩
    You should give it a like, it would motivate me 👍
    public class Main{

    public static void main(String args[])
    {
    // quick sort = moves smaller elements to left of a pivot.
    // recursively divide array in 2 partitions
    // run-time complexity = Best case O(n log(n))
    // Average case O(n log(n))
    // Worst case O(n^2) if already sorted

    // space complexity = O(log(n)) due to recursion

    int[] array = {8, 2, 5, 3, 9, 4, 7, 6, 1};

    quickSort(array, 0, array.length - 1);

    for(int i : array){
    System.out.print(i + " ");
    }
    }
    private static void quickSort(int[] array, int start, int end) {

    if(end

    • @irfanhakim4617
      @irfanhakim4617 2 ปีที่แล้ว +13

      the fact that you just handle a new programmer/coder generation by yourself is really crazyy bro

    • @jaylordjl6337
      @jaylordjl6337 2 ปีที่แล้ว

      Whoaaa how did ya do that simply :( ☺️

    • @Nejad7
      @Nejad7 2 ปีที่แล้ว

      Quit coding tutorials! No that was one of the best technics you ever did. That effort brought this masterpiece, thank you.

    • @SLIME-gx6fo
      @SLIME-gx6fo 2 ปีที่แล้ว +1

      Teach about ai

    • @westmakaveli4003
      @westmakaveli4003 2 ปีที่แล้ว +4

      If only I could smash that like bottom more than once. You really deserve the " likes " bro. Thank you for your help bro.

  • @grecha6322
    @grecha6322 2 ปีที่แล้ว +525

    I can`t believe that exists the guy who has knowledges of all Indian tutorials and he can explain it so aesthetically well. Keep it up! With love from Moscow

    • @dumdumbringgumgum2940
      @dumdumbringgumgum2940 2 ปีที่แล้ว +39

      Are you saying we don't explain in an aesthetically well manner?? I'm taking offence to that.. jk 🤣
      love from India.

    • @synacktra
      @synacktra 2 ปีที่แล้ว +5

      @@NexushasTaken I am Indian, and I agree with you 🤣

    • @poulomidutta4997
      @poulomidutta4997 ปีที่แล้ว

      @@synacktra why bro

    • @poulomidutta4997
      @poulomidutta4997 ปีที่แล้ว +6

      @@NexushasTaken what's so annoying about our accent? I find it sweet and it varies from person to person

    • @2clau
      @2clau ปีที่แล้ว +10

      @@poulomidutta4997 it's not the accent, it's all the Tamil interjections that throw me off.

  • @hawns3212
    @hawns3212 หลายเดือนก่อน +7

    Fun fact, you can swap 2 numbers without a temp variable by doing the following
    int a = 5;
    int b = 10;
    a = a + b; // 15
    b = a - b; // 15 - 10 = 5
    a = a - b; // 15 - 5 = 10
    Not really useful, but a funny tip to know

  • @hollowkaze8728
    @hollowkaze8728 2 ปีที่แล้ว +10

    just finished ur entire java playlist and now the data structures playlist, this channel has really kept me busy this past summer and has really helped me out, never stop doing what ur doing!!

  • @seanfischler1320
    @seanfischler1320 8 หลายเดือนก่อน +3

    dawg your visual representations are absolutely saving me rn, love you

  • @austinolmsted9432
    @austinolmsted9432 2 ปีที่แล้ว +20

    I am absolutely baffled how high quality your videos are. You make everything so easy and fun to understand and learn. Keep up the good work!

  • @HatzzRotmg
    @HatzzRotmg 2 ปีที่แล้ว +4

    I have been trying to understand quicksort by so many different teachers, videos, and forums and this video finally made me understand it. Thank You!

  • @irrationallymadphysicist6945
    @irrationallymadphysicist6945 2 ปีที่แล้ว +10

    Thanks for the concise and clear explanation! Animation can be a pain but know that your hard work is definitely being appreciated

  • @sahu_SuMiT
    @sahu_SuMiT หลายเดือนก่อน +3

    really unbelievable to have u who can put all those recursive and iteration into a movie like animation... just sitback, relax and enjoy what happens .........Awesome, truly awesome.....❤

  • @tubeyoueh
    @tubeyoueh 8 หลายเดือนก่อน +2

    Something about quicksort was just not clicking with me before I found this video. I've never gone from being so confused by a concept to understanding it so well in such a short amount of time. I never comment on youtube videos but this absolutely deserved some praise. Well done and thank you!

  • @bryanlee5522
    @bryanlee5522 ปีที่แล้ว +6

    4 minutes in, and I totally understand it now. Good job. Showing what happens each step helped. This is better than the other video I watched "explain in 4 minutes". Left my clueless. And with your video, I get it immediately.

  • @derfwerd
    @derfwerd ปีที่แล้ว +80

    I quit my job as a data analyst at a big company to become a SWE. Your videos went from being a supplement to another resource to the main resource I lean on in many cases. When I crush my technical interview some time next year, I will let you know. Thanks bro. You are great at what you do and deserve all the success that comes to you.

    • @duonghuong5738
      @duonghuong5738 ปีที่แล้ว +2

      Hello? I have same plan as you, would be great if we can share strategy to learn in this path

    • @saadshakeel6045
      @saadshakeel6045 7 หลายเดือนก่อน +6

      It has been 1 year..! Waiting for the news haha

    • @ogs3721
      @ogs3721 7 หลายเดือนก่อน +1

      It doesn’t matter if you have crushed or not, but you tried. That’s what matters the most. If you haven’t yet, let’s try together.

    • @xTriplexS
      @xTriplexS 2 หลายเดือนก่อน

      How did it go?

    • @a.m.4154
      @a.m.4154 2 หลายเดือนก่อน +3

      Guess it didn't go well.

  • @sumansamanta330
    @sumansamanta330 2 ปีที่แล้ว +15

    Bro! Hats off to you man 😍 Completed the whole playlist 😎 All the basics are now fully cleared! Those real-life examples of stacks, queues, and LinkedList were awesome and all the shorting algorithms are now crystal clear. More power to you man.✌️🙏🙏

  • @Sub-zero1123
    @Sub-zero1123 2 ปีที่แล้ว +1

    I was just checking quick sort on TH-cam yesterday, glad you uploaded it

  • @ManlyMango
    @ManlyMango 2 หลายเดือนก่อน

    Wow really good job! I love the visualization you did and appreciate that you finished out the array to firmly sitck the lesson in mind. Thank you!

  • @jammandu
    @jammandu 2 ปีที่แล้ว +1

    Love this channel growing!

  • @dragon37786
    @dragon37786 3 หลายเดือนก่อน

    Finally, video without skipping recursive parts where are only two elements, now everything is much more clear, thank you.

  • @pranavkumar2030
    @pranavkumar2030 2 ปีที่แล้ว +4

    Such a good explainer and gem of youtube.
    I will constantly support your videos bro! Kudos for all your efforts.

  • @tmphu
    @tmphu ปีที่แล้ว

    I never found a document or video explaining the Quick Sort algorithm this easy until I came to your channel. Hey bro, you're the best professor in the internet, ever!

  • @domss3931
    @domss3931 2 ปีที่แล้ว +1

    You won the quicksort explanation game my dude, well done. I finally got it, THANK YOU 👏

  • @2T1R3D
    @2T1R3D 11 หลายเดือนก่อน

    This is probably the easiest way anyone has explained any algorithm to me to this day!! Thanks, bro!!

  • @boing120
    @boing120 6 หลายเดือนก่อน

    You're the best bro. The writing code with narration section is insanely helpful

  • @1mmunity18
    @1mmunity18 2 ปีที่แล้ว +1

    This is so cool and clear! Good job on the video!

  • @SamipKC-zm3gq
    @SamipKC-zm3gq 2 หลายเดือนก่อน

    I have never seen someone explain and code so easily....this was the best! you are the best!

  • @magl1003
    @magl1003 2 ปีที่แล้ว +1

    Thank you for the videos. They are extremely helpful. Right now, I'm taking Java classes but I rely on your videos to learn the concepts. I'm still a beginner but you have taught me a lot so far.

  • @Anonymationsthecoolanimator
    @Anonymationsthecoolanimator 2 ปีที่แล้ว +3

    Yes finally, I learnt this algorithm. A big thanks for this short and concise tutorial

  • @whipyyy
    @whipyyy 2 ปีที่แล้ว +1

    thx bro, you are a life saver!!! keep up the good content and you have my total support! thx a lot. cheers

  • @shaswatachowdhury9032
    @shaswatachowdhury9032 5 หลายเดือนก่อน

    Amazing tutorial! Keep educating all of us like this ! I loved it. So elegantly and smoothly done..❤

  • @Nik-rh3xl
    @Nik-rh3xl 2 หลายเดือนก่อน

    This is the best video i have seen so far. Straight to the point. Very helpful, Keep up the hard work

  • @octopudding9910
    @octopudding9910 ปีที่แล้ว

    so happy to always find what im looking for here! thank you so much!

  • @yagan_dawn2008
    @yagan_dawn2008 วันที่ผ่านมา

    I had a task to implement the quicksort algorithm in assembly.This video helped me a lot to write the code as i could easily reference my results to yours.Thank you!(It took me around 6 hours of coding to do that lol)

  • @saadkhan-ku8bl
    @saadkhan-ku8bl 2 ปีที่แล้ว +1

    Finally some quality content, easy to understand, Thanks!

  • @sevenyou
    @sevenyou 4 หลายเดือนก่อน

    Love it love it love it frrrr like I couldn't understand this at all from many videos but this made it so easy for me thankkkkss!!!

  • @salatyell
    @salatyell 2 ปีที่แล้ว +2

    I don't usually comment on videos, but I couldn't help myself from taking my hat off to you.
    I'm currently reading an amazing book "Grokking algorithms", and I Just got to the part about quick Sorting, and while he explained it amazingly and I could understand the concept of it and even visualize it, he uses python on his exemples in the book, so it was extremely hard for me to come up with an implementation of the function in java, since here you can't just add and remove elements from and array like in python... So I was looking for videos that explained neatly the implementation of quick sorting in java I couldn't find any that really helped me, but then I remembered THE LEGENDARY BRO CODE! And it just clicked! Thank you so much man!
    My first pieces of basic programming information came from you and I am very thankful because of how concise your code is... The way you pay attention to the convention and the way you write your code elegantly in a way that is easy to read and understand... I try to implement that when I'm writing code and all thanks to you! Keep up the good work, bro!

  • @jeffisded1222
    @jeffisded1222 หลายเดือนก่อน

    The way you implemented quicksort is much better than the other method I found. The other method has this stupid edge-case I can't wrap my head around. Thanks :)

  • @reemoment1319
    @reemoment1319 2 ปีที่แล้ว +8

    This dude deserve 10 million subs

  • @flopani5059
    @flopani5059 4 หลายเดือนก่อน

    Awesome explanation and useful animation!

  • @RoronoaShu27
    @RoronoaShu27 8 หลายเดือนก่อน

    You are saving lives Bro,please continue your hard work. Sorting algorithm is very difficult to explain, you handle it like a Pro Bro

  • @renatocampos3502
    @renatocampos3502 2 ปีที่แล้ว

    You're a monster Bro!! That was amazing explanation about this topic. Keep it up! Thanks for sharing with us!

  • @dineshkumare1750
    @dineshkumare1750 9 หลายเดือนก่อน +3

    I understood these concepts better from this channel than I did in my 5-month DSA semester paper.

  • @lukju6520
    @lukju6520 2 ปีที่แล้ว

    This channel provides so much free information. It's just too good to be true.

  • @yushchenkoalexey
    @yushchenkoalexey ปีที่แล้ว

    That was awesome and easy to understand explanation! Thank you so much!

  • @dominiknowak3613
    @dominiknowak3613 2 หลายเดือนก่อน

    Great job. You explained it well. Good visualisation.

  • @anickkhan
    @anickkhan 2 ปีที่แล้ว

    Best explanation I have found till date. I cannot thank you enough.

  • @vampire_catgirl
    @vampire_catgirl ปีที่แล้ว

    I watched up to the end of the visual explanation, which was very helpful and good by the way. Now I'm going to try and code it myself before watching how you code it

  • @one111won
    @one111won ปีที่แล้ว

    Your visual explanation is on point!!

  • @4EverH0me
    @4EverH0me ปีที่แล้ว

    This is my first comment ever and I really wanted to THANK YOU a lot. You are a great teacher. I am really appreciating your work. Thank you.

  • @aliyanshaikh1547
    @aliyanshaikh1547 8 หลายเดือนก่อน

    Finally someone who explains quicksort nicely. Thanks so much bro

  • @rishiksaisanthosh3171
    @rishiksaisanthosh3171 5 หลายเดือนก่อน

    Thanks bro after watching your i understood the logic more clear.The way you explain algorithms by dry run is excellent

  • @Leo-ld6se
    @Leo-ld6se ปีที่แล้ว

    im grateful for these vids, i have a book about algorithms and data structure but i cant understand a word. your vids are so easy to digest and very helpful toward beginner like me

  • @sapokee2830
    @sapokee2830 10 หลายเดือนก่อน

    Thanks so much. This algorithm has been the bane of my existence for way too long, and I finally get it now.

  • @giaminhpham2281
    @giaminhpham2281 2 ปีที่แล้ว

    This is the first time I understand quicksort, thank you

  • @sallaklamhayyen9876
    @sallaklamhayyen9876 หลายเดือนก่อน

    Wow brilliant explanation .thank you so much

  • @patrickmayer9218
    @patrickmayer9218 8 หลายเดือนก่อน

    *i starts at -1 index, j starts at 0 index
    *if array[j] >= array[pivot], increment j
    *if array[j] < pivot, increment i and swap array[i] and array[j], then increment j
    *once j reaches the pivot, increment i, and swap array[i] and array[pivot]
    Thanks so much for making this, Bro Code, I am not exaggerating when I say this is the only video on the subject that made sense to me (without leaving out crucial details)! Your videos have helped the programming community so much!

  • @youseflol3611
    @youseflol3611 11 วันที่ผ่านมา

    I'm so grateful for this video, i finally understood Quick Sort all thanks to you
    thank you so much ❤❤❤

  • @Anas-qh3hk
    @Anas-qh3hk 2 หลายเดือนก่อน

    I've never been this grateful to anyone before

  • @alexblats
    @alexblats 5 หลายเดือนก่อน

    Man i qas trying a whole day to understamd quick sort and now i understood in almost 15 min! You are a legend

  • @floflo1645
    @floflo1645 ปีที่แล้ว

    Writting this myself relying only on your explanation and demonstration but not looking at your code was a pain in the ass but I managed to do it !!! 💪
    I am feeling a little bit smarter now lol

  • @mangomango5660
    @mangomango5660 8 หลายเดือนก่อน +1

    Man you are a legendary giga chad coder
    your explanation is so good

  • @hernanphillip334
    @hernanphillip334 2 หลายเดือนก่อน

    Wow, this has been the best video that i have found about this topic

  • @jananishetty8353
    @jananishetty8353 7 หลายเดือนก่อน

    Amazing explanation, very easy to understand.

  • @tejasbawa
    @tejasbawa 2 หลายเดือนก่อน

    Tysm, this video helped me a lot.

  • @anonymous49125
    @anonymous49125 3 วันที่ผ่านมา

    For those wondering, line 29 of the quick sort should be: for( int j = start; j < end; j++ ) {
    And NOT: for( int j = start; j < end****-1****; j++ ) {
    Still, great tutorial and they posted the correct code in the comments, just hope this helps those that are getting the wrong result and can't figure out why.

  • @adibahbab6859
    @adibahbab6859 ปีที่แล้ว

    Amazingly explained bro! Thanks.

  • @lightfernandez8484
    @lightfernandez8484 ปีที่แล้ว

    the best video on youtube to understand quicksort .

  • @luisespinosallanos3142
    @luisespinosallanos3142 10 หลายเดือนก่อน

    Bro! Amazing job. Thank you

  • @madhavanrao3626
    @madhavanrao3626 ปีที่แล้ว

    Thanks a lot for this explanation... You are definitely the best java teacher...please continue creating more java algorithms...👏👏👏

  • @bibekkumarpanda4388
    @bibekkumarpanda4388 6 หลายเดือนก่อน

    Great explanation!

  • @fact__slap
    @fact__slap 11 หลายเดือนก่อน

    love the background music, its awesome bro

  • @kelvin4833
    @kelvin4833 ปีที่แล้ว

    love these visual representations

  • @grisha6972
    @grisha6972 ปีที่แล้ว

    your videos are really helpful, Thanks !

  • @jx2pd
    @jx2pd 10 หลายเดือนก่อน

    the best quick sort tutorial!! I don't even use Java, but I understood with this explanation. Thank you

  • @fruko3164
    @fruko3164 7 หลายเดือนก่อน

    This is the best quick sort video I have ever seen

  • @brenooliveira6669
    @brenooliveira6669 2 ปีที่แล้ว

    Hey bro please continue to do this serie, is very helpful. You are a great teacher. Hello from Brazil!

  • @haiderzia1238
    @haiderzia1238 4 หลายเดือนก่อน

    Really good video.Understanding the content was really easy and fun.Thanks alot ❤.

  • @jamalghatit
    @jamalghatit 2 หลายเดือนก่อน

    Well done Bro! thanks from Brazil!!!!

  • @tanvirhasanmonir1627
    @tanvirhasanmonir1627 2 ปีที่แล้ว

    Thanks a lot for putting such a great effort to teach us.

  • @RicardoVargasM
    @RicardoVargasM 2 หลายเดือนก่อน

    You are programming Jedi Master. I appreciate it

  • @pv2930
    @pv2930 ปีที่แล้ว

    U made itvery easy to understand..thank you so much 😊

  • @user-rs5qf9my8n
    @user-rs5qf9my8n 5 หลายเดือนก่อน

    thanks bro needed this for my college quiz very helpful

  • @nikilnikki18
    @nikilnikki18 ปีที่แล้ว +1

    Seriously words cannot explain the efforts u have put in for us !! I'm 18 I'm from India U are helping me so much 💕 thanks bro

  • @hoatranminh5216
    @hoatranminh5216 ปีที่แล้ว

    Thank you so much Bro, your Tutorial help me so much in learning code. Hope many success come to you, Bro

  • @jp-hh9xq
    @jp-hh9xq ปีที่แล้ว

    Yeah, Bravo!! I have watched a dozen videos on QuickSort. I use it every day as a developer, but this video is the best to explain it to yourself or others, in why you made a particular design decision or not. I pick my partitions carefully, and for just the reasons stated in this video. This video helps me to explain to others why I made the decisions I did!!! Thanks!

    • @jp-hh9xq
      @jp-hh9xq ปีที่แล้ว

      After reading your comment above, I just want to say, seriously, dozens of videos, I watched on the topic and this is by FARRRRRRRRRRRR the BEST! This is what people want to see, they just don't know it yet. Keep up the good work!!!!!

  • @notdumb3182
    @notdumb3182 ปีที่แล้ว

    This is the best explaination of quicksort ever made ♥️♥️♥️

  • @kathykaikai7152
    @kathykaikai7152 2 ปีที่แล้ว +1

    You're a legend!

  • @Snowmanver2
    @Snowmanver2 2 ปีที่แล้ว

    thank you, bro, you're the best!

  • @johneagle4384
    @johneagle4384 26 วันที่ผ่านมา

    Cool!, Really cool!
    It helped me understand how QS works.

  • @user-tm5kn6kt5x
    @user-tm5kn6kt5x ปีที่แล้ว

    Thank you bro, now I understand algorithms, you teach better than in university ❤

  • @harshithramsundararaman6943
    @harshithramsundararaman6943 หลายเดือนก่อน

    thank you so much!!!

  • @inhhai6773
    @inhhai6773 2 ปีที่แล้ว

    I found quicksort really confusing until I watched this video. Thanks a lot bro, I hope you make more videos.

  • @EmdaKidmit
    @EmdaKidmit 2 ปีที่แล้ว

    The best explanation in the youtube world Thank you very much bro

  • @kosolomon123
    @kosolomon123 2 ปีที่แล้ว

    quick sort learned! thanks!

  • @SLIME-gx6fo
    @SLIME-gx6fo 2 ปีที่แล้ว

    This is my fav. Playlist!

  • @neelsoni13062
    @neelsoni13062 11 หลายเดือนก่อน

    Perfect Amazing

  • @Julian-sn9vc
    @Julian-sn9vc 2 ปีที่แล้ว

    your videos are amazing keep it up bro

  • @juliannafotheringham7101
    @juliannafotheringham7101 7 หลายเดือนก่อน

    amazing amazing amazing explanation

  • @HaoNguyen-km9xj
    @HaoNguyen-km9xj 2 ปีที่แล้ว

    It's a very helpful series. Let make more videos like this...

  • @jasper5016
    @jasper5016 7 หลายเดือนก่อน

    You are a savior!

  • @Yazan_Majdalawi
    @Yazan_Majdalawi ปีที่แล้ว +1

    Amazing video! can you do another one for the analysis of its time complexity? would be great :)

  • @mrmemes5
    @mrmemes5 2 ปีที่แล้ว +1

    Bro this is really awesome