Sorting - Part 1 | Selection Sort, Bubble Sort, Insertion Sort | Strivers A2Z DSA Course

Sdílet
Vložit
  • čas přidán 22. 07. 2024
  • Book a FREE career counseling session with Learnbay: bit.ly/3km2s6W
    @Learnbay is an established EdTech platform with expertise in Data Science & AI and Full-Stack Development courses headquartered in Bengaluru.
    They offer several IBM-certified Data Science courses. Since 2015, Learnbay has helped 10,000+ people to have a successful safe career transition.
    Follow Learnbay platforms to stay connected for the latest updates & information: linktr.ee/Learnbay
    #Learnbay #learnbaycourse #learnbayreview #learnbaydatascience #learnbaycoursereview #learnbaydatasciencecoursereview #learnbayfullstack
    Notes/C++/Java/Python Codes:
    Selection sort: takeuforward.org/sorting/sele...
    Bubble Sort: takeuforward.org/data-structu...
    Insertion Sort: takeuforward.org/data-structu...
    Full Course: takeuforward.org/strivers-a2z...
    You can follow me across social media, all my handles are below:
    Linkedin/Instagram/Telegram: linktr.ee/takeUforward
    0:00 Intro
    2:45 - Selection Sort
    6:50 - Pseudo code / implementation for Selection Sort
    14:28 - C++ code for selection sort
    17:41 - Bubble Sort
    22:00 - Pseudo code / implementation for Bubble Sort
    25:52 - C++ code for bubble sort
    31:40 - Insertion Sort
    36:55 - Pseudo code / implementation for Insertion Sort
    38:52 - C++ code for Insertion Sort

Komentáře • 983

  • @takeUforward
    @takeUforward  Před rokem +47

    Book a FREE career counseling session with Learnbay: bit.ly/3km2s6W
    Let's march ahead, and create an unmatchable DSA course! ❤
    Can someone please add timestamps, I will add them post-it.

    • @sweetyjain8204
      @sweetyjain8204 Před rokem

      Hey @striver @take U forward
      , it's a humble request can u, please complete this series soon as the placement season is coming soon....🙏

    • @Vikash-zq7vx
      @Vikash-zq7vx Před rokem

      Hey Striver please complete the series.

    • @mgfreefirelover4471
      @mgfreefirelover4471 Před rokem

      @takeUforward Hey!
      Can you complete Binary search Section more quickly

    • @aniltandivitb4482
      @aniltandivitb4482 Před rokem

      Bhaiya , if we solve a question and if need to sort the array then which algo we would to implement

    • @webtestingui7187
      @webtestingui7187 Před rokem +2

      Kaha thay aap,maine itna YT me search kia but aapka channel suggest nahi huwa until mera ek dost ne nahi bola hota
      Maira DSA teacher ne jo topic clear nahi karwa pa a aap wo kar di a
      Thank you

  • @saurabh8260
    @saurabh8260 Před rokem +212

    A lot of problems are going on in my life right now. But still I'm showing up everyday to learn something new in dsa and to solve questions.
    Problems will come and problems will go but I should continue my hustle.
    All of our struggles will pay off one day.

    • @dhruvrajsinhgohil6715
      @dhruvrajsinhgohil6715 Před rokem +27

      Hope is the most precious thing do not lost it

    • @darshanakv4946
      @darshanakv4946 Před 3 měsíci +1

      Beautiful message that I saw today!

    • @pulkit-rastogi97
      @pulkit-rastogi97 Před 3 měsíci +1

      This motivate me, I am going through some similar situation

    • @SauravSingh-xm6nn
      @SauravSingh-xm6nn Před 2 měsíci +3

      @@pulkit-rastogi97
      don't lose your hope , just keep giving your best so that you won't regret, in fact if you honestly give your best you can , you are likely to succeed !

    • @vaibhavagarwal602
      @vaibhavagarwal602 Před měsícem +1

      Same man, i was struggling to get up from bed the entire day. But finally at 11pm i decided i will atlest spend the last hout of my day working towards my financial independece

  • @msdarshankirthic9990
    @msdarshankirthic9990 Před rokem +119

    Selection Sort TC -> worst - O(N^2) best - O(N^2)
    2:45 - Selection Sort
    6:50 - pseudo code / implementation for selection sort
    14:28 - C++ code for selection sort
    Bubble Sort TC -> worst - O(N^2) best - O(N)
    17:41 - Bubble Sort
    22:00 - pseudo code / implementation for bubble sort
    25:52 - C++ code for bubble sort
    Insertion Sort TC -> worst - O(N^2) best - O(N)
    31:40 - Insertion Sort
    36:55 - pseudo code / implementation for insertion sort
    38:52 - C++ code for insertion sort

    • @afzalmd23
      @afzalmd23 Před 7 měsíci +6

      Thinking about your notes📝 😮😮

  • @chhavigoel7030
    @chhavigoel7030 Před 8 měsíci +28

    So many videos on Sorting on the internet yet this proves to be the BEST. Thank you so much.

  • @hypernova5159
    @hypernova5159 Před rokem +23

    The amount of effort you put in these videos is truly amazing. Thanks a lot 🙏

  • @aydasu
    @aydasu Před rokem +9

    Striver, you are a gift to us all! thanks so much!

  • @nandhakrishna2330
    @nandhakrishna2330 Před 8 měsíci +13

    The amount of effort you put in these videos is truly amazing. 🙏

  • @raimasoni3013
    @raimasoni3013 Před rokem +130

    2:45 Selection Sort
    17:41 Bubble Sort
    31:40 Insertion Sort
    😊

  • @omgaikwad5962
    @omgaikwad5962 Před rokem +8

    HI Striver,
    One request please provide the videos for upcoming topics asap and Big thank for providing such an amazing series.

  • @charlesbabbage6786
    @charlesbabbage6786 Před 5 měsíci +6

    What an AMAZING teacher!!!

  • @sarthaksharma9322
    @sarthaksharma9322 Před měsícem +1

    Understood! Thanks Striver for all this knowledge you are providing for free!

  • @codingfunda1813
    @codingfunda1813 Před rokem +1

    Bhaiya I am following your dsa AtoZ sheet.From 2 day i am trying to understand sorting concept but now it's become clear. Lots of love

  • @sumitvishwkarma6907
    @sumitvishwkarma6907 Před rokem +5

    This is going to be one of the best series of all time, thankyou so much raj bhaiya, just a small request can you please upload new videos asap, btw thankyou again ❤

  • @Manishgupta200
    @Manishgupta200 Před rokem +6

    Thankyou Striver. It's really an easy to understand. I also learnt to find Time Complaxity from every code by myself after seeing this video. Please make video on other sorting methods. ❤

  • @surajgoraicse
    @surajgoraicse Před 9 měsíci

    Finally I found the best DSA course on CZcams. ❤The way you explain concept is awesome. ❤❤
    There was not a single second when I felt bored . Thankyou very much for your effort. ❤❤
    ❤❤

  • @hari7939
    @hari7939 Před rokem +1

    mannnnn!!!! Just addicted to ur teaching🔥🔥, every little concept is crystal clear

  • @sukhpreetsingh5200
    @sukhpreetsingh5200 Před rokem +20

    😅😅As usual awesome!!

  • @cinime
    @cinime Před rokem +4

    Understood! Amazing explanation as always, thank you very much for your continuous effort for making the video!!

    • @universal-1903
      @universal-1903 Před měsícem

      bro in insertion ,why does i has starting value of 0 ,shouldnt it be 1 as single element would be sorted anyways

  • @MohsinAli-zg3hr
    @MohsinAli-zg3hr Před rokem +1

    UNDERSTOOD. Thanks for giving us this course!

  • @JazzSparrow0321
    @JazzSparrow0321 Před 4 měsíci

    I find this is best DSA video i have ever seen on youtube. Thabak you Mr. TUF for this informative session.

  • @milindjarsaniya
    @milindjarsaniya Před 10 měsíci +3

    PERFECTLY UNDERSTOOD! ❤

  • @animexworld6614
    @animexworld6614 Před rokem +108

    Hey striver , it's a humble request can u, please complete this series soon as the placement season is coming soon....🙏

    • @bishalkundu7592
      @bishalkundu7592 Před rokem +7

      Yes striver 😭 plzzz Want to learn the whole series just from u. Already watched DP and Graph and Trees playlist from ur channel. Plzz striver try to complete this series as soon as possible 😭

    • @harshavardhan184
      @harshavardhan184 Před rokem +1

      Yes please 🥺🥺🥺

    • @venomhighs1937
      @venomhighs1937 Před rokem +5

      brother once striver reaches to Poland he will be regular in posting videos !!

    • @yikes3807
      @yikes3807 Před rokem +5

      @@bishalkundu7592 u completed DP graph trees and you are waiting for basic topics?

    • @bishalkundu7592
      @bishalkundu7592 Před rokem

      @@yikes3807 Not basic but ya heaps Sliding windows stacks Queues Binary Search. Waiting for this

  • @deepak8720
    @deepak8720 Před 9 měsíci +1

    Understood.
    Thanks for your commitment. That in itself is amazing motivation to keep going.

  • @reddotcheese
    @reddotcheese Před 5 měsíci +1

    It's easiest explanation I have seen. Appreciate the effort that went.

  • @28_g_pawanvinayakawasthi23
    @28_g_pawanvinayakawasthi23 Před 8 měsíci +11

    Hi Striver @takeUforward , in the insertion sort ,the outer loop i.e. the loop with i should start with i=1 instead of i=0 because the j takes the value of i and in the while loop it says j should be greater than 0 so it will always stand false for the first iteration ( j=i=0) and moreover we don't need to check the correct order of single element . Please correct me if i am wrong because i am just saying what I understood .

    • @ShubhraneelChakraborty-cj8zm
      @ShubhraneelChakraborty-cj8zm Před 6 měsíci +2

      Yeah you are right I believe. When I saw the outer loop, I was thinking the same thing and when I run the code, it prints the same output as with i=0, just as I thought it would be during the dry run.

  • @shivamsingh-we7ek
    @shivamsingh-we7ek Před rokem +11

    please complete this series soon because only 3,4 months are left for placement season its a humble request

  • @tejasbisen6215
    @tejasbisen6215 Před rokem +1

    I never seen before content where
    🔥Crystal level concept Explained ✨Dope🔥

  • @suryaprakashiitbhu191
    @suryaprakashiitbhu191 Před 7 měsíci +1

    Striver, Your content is truly outstanding and incredibly informative! Always thank you for your relentless hard work and consistently delivering the best content.❤

  • @nashimbiswakarma
    @nashimbiswakarma Před rokem +3

    Otimization:
    39:14 Guys run outer loop from int i=1 because there is no way to check first element with left .

    • @ramrawat681
      @ramrawat681 Před rokem

      Yes that how we can also make best case complexity to O(1) by Initializing cnt =0 in outer loop and in while loop we do cnt++ and if while loop never run (best case ) then cnt remain at zero then in outer loop give a condition if (cnt==0) break;

    • @jaypandya2227
      @jaypandya2227 Před 3 měsíci

      @@ramrawat681 no buddy we can't that's an error in video i think because while loop is running for every single element and if the element is in correct position means there's no greater element before it cnt will be zero and if you break the loop no elements after that will be checked so it will not give right answer i wonder if you implemented it successfully

  • @yashvardhansingh5341
    @yashvardhansingh5341 Před 3 měsíci +6

    For bubble sort striver you are using i>=1 in outer loop in the pseudo code but while using the code editor you are using i>=0.

    • @ankitpal8044
      @ankitpal8044 Před měsícem

      Same doubt??

    • @nirbhaybhardwaj4330
      @nirbhaybhardwaj4330 Před 27 dny

      there is no need of going till i>=0 . but if you go , this is also right .....i=0 is automatically got minimum number when we are sorting

  • @ashwinikumarray__a2-255
    @ashwinikumarray__a2-255 Před rokem +2

    Quality content....
    Explained effectively and completely..

  • @Raj10185
    @Raj10185 Před rokem +7

    one suggession for insertion sort
    why we run outerloop from i = 0 we should start directly from i = 1 till iarr[j])
    {
    int temp = arr[j];
    arr[j]=arr[j-1];
    arr[j-1]=temp;
    j--;

    }

    • @AryanRishi-vk6et
      @AryanRishi-vk6et Před 2 měsíci +1

      it wouldn't impact anything if the outer loop is running from 0 to n-1 then when i = j = 0 it will no go into the while loop and move on to next iteration of i

    • @dhruvverma1001
      @dhruvverma1001 Před měsícem

      I want to understand how does is not give index out of bound error by accessing -1, or it does short curcuit

  • @valiz2628
    @valiz2628 Před 5 měsíci +35

    its 2:20am at 10 am i have exam,so jai shree ram,aur jai baba raj

  • @harshavardhan184
    @harshavardhan184 Před rokem +1

    Amazing yar.. please continue the series faster.. eagerly waiting to learn more!!!

  • @amareshghosh3502
    @amareshghosh3502 Před 7 měsíci +2

    khub sundar, osadharon🙂

  • @anshulkahar1891
    @anshulkahar1891 Před rokem +3

    Striver any rough idea how long will this a2z course will go

    • @takeUforward
      @takeUforward  Před rokem +8

      4/5 months, as the advanced section is completed, so its just the basics I need to complete. We will gain speed once am back in Europe in feb 4th weeek

    • @Lucifer-xt7un
      @Lucifer-xt7un Před rokem

      @@takeUforward hey brother can we expect this series will be done by may last.

  • @066-roshankumar6
    @066-roshankumar6 Před 10 měsíci

    Best Sorting video until Now THanks bhaiya...

  • @prayushgiri6515
    @prayushgiri6515 Před 10 měsíci +1

    understood!!!
    Thanks Striver bhaiya

  • @sparshverma4030
    @sparshverma4030 Před rokem

    Understood.
    Such an amazing course.

  • @pranjalisingh7484
    @pranjalisingh7484 Před rokem

    Motivated me today to solve questions again .... And learn ...

  • @shubhivishwakarma9331
    @shubhivishwakarma9331 Před 9 měsíci

    you are amazing
    all the sorting you taught looks very easy after watching your vdo

  • @siddhatagadhe6176
    @siddhatagadhe6176 Před rokem

    understood totally, literally I forgot my phone while your lecture. Thanks a lot

  • @roshninv
    @roshninv Před 11 měsíci

    Completed the sorting - I , thank you for the breif explaination bhaiya.

  • @UserUser-tn8tv
    @UserUser-tn8tv Před 10 měsíci

    I just wanna say Thank U you are a big brother figure for me...

  • @MitaliMaurya-k4x
    @MitaliMaurya-k4x Před 27 dny +1

    Thankyou for your efforts! Dsa scares me, but you are making it easy for me

  • @muhammadzubair957
    @muhammadzubair957 Před 9 měsíci

    Good Explanation in the Sorting algorithm. Thanks a Lot❤❤ Strivers

  • @chiranjeebpanda8926
    @chiranjeebpanda8926 Před měsícem

    Understood. Best explanations for every sorting algo :)

  • @changed217
    @changed217 Před 11 měsíci

    Understood, thank you so much for the lecture and your efforts.

  • @sahitid5570
    @sahitid5570 Před 12 dny

    Such a detailed and perfect explanation. Thanks a lot Striver!! Understood the concept really well.

  • @rizwanshaikh4024
    @rizwanshaikh4024 Před 5 měsíci +1

    Understood, thanks STRIVER

  • @user-vh7qb3zs4j
    @user-vh7qb3zs4j Před 9 měsíci

    your explanation is just Awesome. UNDERSTOOD

  • @AbhishekChaurasiya-op6pq
    @AbhishekChaurasiya-op6pq Před 2 měsíci

    Understood everything and it became crystal clear topic

  • @fullstacker786
    @fullstacker786 Před 6 měsíci

    understood it way better than anywhere else

  • @y_nr4819
    @y_nr4819 Před 7 dny

    Really Thanks to You Sir , Got all my PRoblems Cleared in this Video

  • @SubhashKumar-bj5xd
    @SubhashKumar-bj5xd Před rokem

    I really appreciate your effort. And your videos are helping me a lot. thank you sir🙏

  • @user-sc7vy3ye6v
    @user-sc7vy3ye6v Před měsícem

    You are the best man... I donot know where this energy come from...

  • @priyanshushrivastava4453

    great video and easy explanation helps a lot .

  • @anvith-error
    @anvith-error Před 10 měsíci

    Thank you striver, amazing explaination.

  • @a_maxed_out_handle_of_30_chars
    @a_maxed_out_handle_of_30_chars Před 8 měsíci +2

    simple and to the point, thank you :)

  • @VishalYadav-gk1kg
    @VishalYadav-gk1kg Před 7 měsíci +1

    Very Nice explanation sir, Thank you!

  • @DevashishJose
    @DevashishJose Před rokem

    Understood. Thank you for your hard work.

  • @CodeBoost8375
    @CodeBoost8375 Před rokem

    As always excellent lecture ☺️☺️.

  • @ArvindSingh-wj7vy
    @ArvindSingh-wj7vy Před 5 měsíci +1

    Absolutely understood Stiver!💌

  • @ShubhamSharma-zq2xn
    @ShubhamSharma-zq2xn Před 3 měsíci +2

    Stirver-Forever, Just striving to become the best version of myself. All thanks to raj vikrmaditya bhaiya. You're the best hope for students like us, belonged from tier-3 college, where there is no hope in hell to get a sde job, but their is this man standing with a freakin Sun the light the path for use. I don't know how I will thank you but one day I believe all my hard work will pay off when I will meet you and telling you my story of life, how I made zero to Prodigy. Till I didn't hit it, byy sir I am going back to hustle....

  • @NIKHILKUMAR-zg3us
    @NIKHILKUMAR-zg3us Před 9 měsíci

    understood
    Thank you so much for giving this fabulous course.

  • @hareshnayak7302
    @hareshnayak7302 Před 3 měsíci

    Understood,thanks striver for this amazing video.

  • @yeswanthb
    @yeswanthb Před rokem

    awesome explanation STRIVER thankyou

  • @shivamjaiswal1263
    @shivamjaiswal1263 Před rokem

    Hats off to your effort and teaching skill striver. No one can explain as you were explaining topics🫡🫡🫡

  • @tvnalkkmgaargyreddy9548
    @tvnalkkmgaargyreddy9548 Před měsícem +1

    Explanation is amazing 😍

  • @kirankumari-xx1rs
    @kirankumari-xx1rs Před 5 měsíci

    Thank you Striver, I am in my first year but I am learning a lot from you.

  • @rishikeshg8926
    @rishikeshg8926 Před 8 měsíci +1

    Understood
    Thanks for this video bhai!

  • @jatilyadav4000
    @jatilyadav4000 Před rokem

    Amazing Video.. thank you sir

  • @anishchhabra6085
    @anishchhabra6085 Před 6 měsíci +1

    Understood, great lecture.

  • @jinhuang7258
    @jinhuang7258 Před rokem

    Understood. You are the best!

  • @Shiv_kolekar
    @Shiv_kolekar Před 12 dny

    Understood completely !!

  • @devanshimishra9786
    @devanshimishra9786 Před měsícem

    Thanks for this lecture finally understood those sorting techniques

  • @MuralidharanR-hl7gt
    @MuralidharanR-hl7gt Před rokem

    Understood, And big thanks for all the videos.

  • @ishitagupta3321
    @ishitagupta3321 Před 9 dny

    understood
    Thanks striver!

  • @siftainejaz4772
    @siftainejaz4772 Před rokem +2

    UNDERSTOOD. THE WAY YOU TEACH IS BRILLIANT.

  • @harshitshrivastava9121
    @harshitshrivastava9121 Před rokem +1

    thanks for making this playlist

  • @curs3m4rk
    @curs3m4rk Před 4 měsíci

    This is a very good explanation.
    With help of explanation itself I'm able to code and did the sorting.
    Really appreciate the efforts.

  • @srishtijha3
    @srishtijha3 Před rokem

    Thankyou for putting out such valuable content

  • @ramraj72
    @ramraj72 Před rokem +1

    So nice session bro..very well explained

  • @anujsamdariya984
    @anujsamdariya984 Před měsícem

    Best Explaination of Insertion Sort!!!

  • @andor_andor
    @andor_andor Před 8 měsíci

    Great work, Striver. Best Free Resource

  • @kimparajusivanagatrishuled1155

    understood . Thanks for best explaination

  • @Chandraprakash-kx4ic
    @Chandraprakash-kx4ic Před 8 měsíci

    Understood everything. Thank You very much:)

  • @gokulkishore6366
    @gokulkishore6366 Před 5 měsíci +1

    great bhai

  • @ummedchoudhary3977
    @ummedchoudhary3977 Před 11 měsíci

    understood comfortably keep it up bro 💯

  • @shashamnk2525
    @shashamnk2525 Před 8 měsíci

    folks that was 5:29 AM in striver's clock , please hit the like button for the efforts he makes for us , forever grateful.

  • @waqas3051
    @waqas3051 Před 4 měsíci

    Understood, Very well explained.

  • @devangsharma7550
    @devangsharma7550 Před rokem

    understood!! amazing...

  • @everythingabout3479
    @everythingabout3479 Před měsícem

    Thank you so much striver. Your each and every video is such nice 👍

  • @kumaraditya7795
    @kumaraditya7795 Před 11 měsíci

    Understood in a very good way

  • @siddhanbaranwal2206
    @siddhanbaranwal2206 Před měsícem

    Gotcha Sirr.....!!!!!

  • @gulabchandgupta5486
    @gulabchandgupta5486 Před rokem

    Best sorting explanation bhaiya ever i seen love from jamshedpur🤩☺

  • @ankitdhattarwal2286
    @ankitdhattarwal2286 Před rokem +1

    thank you sir for good explanation and provide best dsa sheet and in this video i first time hear --- left chota -- , ( left small ) ---> at 38 : 40 😁😁 and again thank you sir ❤

  • @ReNaq313
    @ReNaq313 Před 8 měsíci

    Amazing approaches 🔥🔥

  • @rituraj2636
    @rituraj2636 Před 26 dny +1

    Amazing content :)

  • @kingbadshah452
    @kingbadshah452 Před 6 měsíci +1

    thanks for this lecture ,,,, understood everything