Bubble Sort in Plain English

Поделиться
HTML-код
  • Опубликовано: 30 июл 2024
  • Learn to implement the Bubble Sort algorithm and ace your coding interview.
    👍Subscribe for more data structure and algorithm tutorials like this: goo.gl/6PYaGF
    🚀Get the full data structures and algorithms course: bit.ly/2YfL3zr
    CONNECT WITH ME
    My Courses: codewithmosh.com
    My Blog: programmingwithmosh.com
    My Facebook: / programmingwithmosh
    My Twitter: / moshhamedani
    Data Structures and Algorithms is an essential topic taught to computer science and software engineering students to help them learn logical thinking and problem solving. That's why a lot of companies these days ask data structure and algorithm questions in their interviews. Sorting algorithms are particularly important. Even though you never have to implement a sorting algorithm in real life, studying and understanding these algorithms help you become better solving larger, more complex problems.

Комментарии • 169

  • @utpalbarman6125
    @utpalbarman6125 4 года назад +28

    Thanks Mosh, these topics are helpful for a quick look before any job interview, data structure is very common topic in any CS related job interview, I can still remember that I was asked about Bubble Sort in an interview, and to explain the complexity. Happy to see you code in Java.

    • @vikramsapate8703
      @vikramsapate8703 3 года назад

      @@programmingwithmosh I searched Mosh Hamedani on LinkedIn but I didn't find you.

  • @zeloguy
    @zeloguy 4 года назад +26

    OMG I haven't heard of the Bubble Sort since college in '92!

  • @mahmudulislam5303
    @mahmudulislam5303 4 года назад +4

    thank you Mosh. It has been a great pleasure to learn from you in youtube and udemy. You are a great teacher. You make complex things so easier, I am grateful to you.

  • @ashishpuma3950
    @ashishpuma3950 4 года назад +3

    Just completed your course from Udemy and I'm in love with the way of your teaching! So glad you have a RUclips channel!

  • @AaronAsherRandall
    @AaronAsherRandall Год назад +12

    I’m a C# dev and I am just shocked at how similar Java is to C#. It is literally 95% the same syntactically! I guess I know Java now 😂

  • @Ophois47
    @Ophois47 4 года назад +4

    This was a great one Mosh, we can't thank you enough for what you do.

  • @Dev_God
    @Dev_God 2 года назад +1

    Thanks, Mosh! This is a fantastic video that helps me understand how it is really working! I understand the bubble sort from the book, but I never knew how to code without your video!

  • @bharat_thapa_
    @bharat_thapa_ 4 года назад +2

    Only if RUclips were filled with such good content, it would be paradise for IT students.
    Your approach to teach is just beautiful.
    I need to ask this to you @Mosh:
    "Your opinion on PHP programming language"
    Thanks!

  • @alestoraldous7036
    @alestoraldous7036 4 года назад +44

    mosh is one among the best instructors

  • @jimshapedcoding
    @jimshapedcoding 4 года назад +7

    Mosh gave me the motivation to try my own luck in being an instructor on my RUclips Channel.
    I wish I will have his calmness and perfect explaining skills just as he does.
    Lots of love Mosh

  • @talhasiddique2376
    @talhasiddique2376 4 года назад +1

    Thank you Professor Mosh Hamedani for the tutorials. If I were able to take your courses I would definitely grab the chances to do your coursrs.

  • @vandithsreenivas5966
    @vandithsreenivas5966 4 года назад

    The sort of sort I was so confused about! Thanks Mosh!

  • @angmathew4377
    @angmathew4377 4 года назад +1

    nice optimization. We also love to hear atleast one use case where it can be used practically other than in exams or interviews.

  • @Vassimau
    @Vassimau 2 года назад

    I had no clue you could declare variables inside your for loop. That's awesome.

  • @GfoxSim
    @GfoxSim 4 года назад

    The best programmer and instructor I’ve ever seen!

  • @retrojimmyx
    @retrojimmyx 3 года назад +1

    Glad you optimised at the end there. Nice vid, thanks.

  • @DiamondTech11
    @DiamondTech11 4 года назад

    Your are the best sir, and I got this feeling when I first saw your python course for beginners approximately 3 years ago.

  • @Aryan-ly5ho
    @Aryan-ly5ho 4 года назад +2

    Mosh you are professional. You make a Quality base video in less earning 💰 . THANK YOU .

  • @fast5883
    @fast5883 4 года назад +1

    Best experienced instructor ever!!!

  • @sagniksaha4179
    @sagniksaha4179 4 года назад +4

    I love your teaching .sir pls make a video on how to think for the soln of any given programming problem.

  • @user-ui3du8wo6c
    @user-ui3du8wo6c 2 года назад

    Thanks a lot !
    You explained it in just 11 minutes and saved me 💙💙💙💙

  • @feranmiafrica9528
    @feranmiafrica9528 4 года назад +12

    I'm currently taking your react native course.. you're just the best

    • @feranmiafrica9528
      @feranmiafrica9528 4 года назад +1

      @@programmingwithmosh of course I always do

    • @KodiLearn
      @KodiLearn 4 года назад +2

      @@programmingwithmosh Please create separate django course.

  • @zolisawelani9338
    @zolisawelani9338 3 года назад

    I really enjoyed this Mosh, thanks!

  • @highmountdigital
    @highmountdigital 4 года назад

    Great video on Bubble Sort! Super instructive 👊

  • @acodingknowledge5818
    @acodingknowledge5818 4 года назад

    You are the best one mr.mosh, the one of people who I want to be like is you, tnx a lot from your teachs.🤗

  • @aneeshkatkam8271
    @aneeshkatkam8271 4 года назад +1

    Mosh thank you for more courses am a fan

  • @krzysztofmazurkiewicz5270
    @krzysztofmazurkiewicz5270 4 года назад

    I wish my coding teacher explained it like that :) Nice one!

  • @umarsiddique511
    @umarsiddique511 4 года назад +8

    Mosh u r the best among all . u r the only instructor. who teaches like that. thank u.

    • @manid8302
      @manid8302 4 года назад

      I think telusko is much better.. But also mosh is not bad

  • @DeepakKumar-uz4xy
    @DeepakKumar-uz4xy 4 года назад

    Thank you mosh for this awesome explanation

  • @khalidjabr7089
    @khalidjabr7089 4 года назад +1

    thank you for these incredible videos , you helped me in python and C sharp but i was wondering if you can do a video about data structure and algorithm in C++
    hope you read this comment

  • @sabitkarabayev9141
    @sabitkarabayev9141 3 года назад

    Very clear and understandable.

  • @shuvramdutta8362
    @shuvramdutta8362 4 года назад +1

    Hello sir .
    First of all thank you very much for your tutorial courses, I learnt a lot from them and you are one of the best instructor .
    Sir, can make a tutorial course on machine learning or a complete stack on data science.

  • @xxwolf_gamezxx3358
    @xxwolf_gamezxx3358 4 года назад +1

    You are amazing, I have watched and completed all of your courses. I think you are the best programmer in the world

    • @xxwolf_gamezxx3358
      @xxwolf_gamezxx3358 4 года назад +1

      I have shared all of your videos, you are my role model (for programming)!

  • @sampurnakc
    @sampurnakc 4 года назад +2

    If only I had full access to his courses!

  • @keyasarker1559
    @keyasarker1559 4 года назад

    I have done your 6 hour python course and other 2 too.
    You are the best teacher i have ever seen in my life.Hats off to you.May you see my comment.
    I have a ❓
    My django site was not found, when i cannot find it, when searched it through another mobile
    It said"error 404"

  • @yayahkamara5468
    @yayahkamara5468 4 года назад

    Thanks Mosh

  • @DarshanaHashendra
    @DarshanaHashendra 4 года назад

    Brilliant video, amazing teacher so far I found for teaching programming techniques

    • @KodiLearn
      @KodiLearn 4 года назад +1

      @@programmingwithmosh Please mosh create separate django course.

  • @mikeafter5
    @mikeafter5 3 года назад

    Thanks very much!

  • @raphaelnk5492
    @raphaelnk5492 3 года назад

    Wow... That's brilliant. Using array.length - i

  • @sujitprabhakaran9886
    @sujitprabhakaran9886 5 месяцев назад

    Mosh has got a million dollar Smile. Just by looking at him smile makes me very happy even in my toughest of times.

  • @infomoreandmore
    @infomoreandmore 2 года назад

    I was really stuck on second iteration.....and this video saved my brain.....
    Thanks...
    :?

  • @demesadavenickole6580
    @demesadavenickole6580 Год назад

    Thank youuuu

  • @averageguy985
    @averageguy985 4 года назад +2

    Yes, we need more of the algorithms lectures

    • @averageguy985
      @averageguy985 4 года назад

      @@programmingwithmosh already did, with my entire friends circle ☺️ thank you so much for sharing your knowledge and experience with us ☺️

    • @KodiLearn
      @KodiLearn 4 года назад +1

      @@programmingwithmosh Please create separate django course. Please Mosh.

  • @gamerthinks
    @gamerthinks 3 года назад

    really understandable

  • @bishalbomjan8379
    @bishalbomjan8379 4 года назад +1

    Sir you are god level in programming.

  • @kashemvai5025
    @kashemvai5025 2 года назад

    great explanation

  • @yassersultan9170
    @yassersultan9170 4 года назад +1

    Thanks

  • @discreet_boson
    @discreet_boson 4 года назад

    I love it when mosh uploads

  • @shyamsundarshrestha7590
    @shyamsundarshrestha7590 4 года назад

    you are the best sir

  • @sanathgowda877
    @sanathgowda877 10 месяцев назад

    Awesome 🎉

  • @aminpourhadi6188
    @aminpourhadi6188 4 года назад +2

    Hi Mosh!
    Thanks for the brief and clear explanation. But I would like to suggest to use JS instead of Java. because it more general + everybody can use it even in his browser and easy to understand 😉
    however, you are amazing & kardorost😎

  • @alimohmed9630
    @alimohmed9630 4 года назад

    you are the best instructor has ever seen 💚

    • @alimohmed9630
      @alimohmed9630 4 года назад

      @@programmingwithmosh Your welcome 💚

  • @xXHelsingGamingXx
    @xXHelsingGamingXx 4 года назад

    Sensei, You are awesome!! :-)

  • @nishantrohilla5058
    @nishantrohilla5058 4 года назад +3

    Your are the beast teacher i am of 14 and from India I learn python with the help of you thankyou for help you are the beast instructer i make some programme with the help of you python corsethankyou
    very much and losts of love from India 🇮🇳🇮🇳

  • @rajveersamra7240
    @rajveersamra7240 4 года назад

    Hi, do you think your gonna make the other parts of the java course series like intermediate

  • @biruk9
    @biruk9 2 года назад

    thank you.

  • @mudamuda6093
    @mudamuda6093 3 года назад

    If we put a boolean status to determine if the array has been swapped, but the array we pass in initially has the first item smaller than the last item, than the status remains unchanged and returns.So if we pass in an array of [0,1,4,3,5] will the first 2 items be compared, seen as "arranged" and return immediately? please point out any flaws in my logic.Im referring to code at 10:13, thanks in advance.

  • @arifbillahsheikh9452
    @arifbillahsheikh9452 4 года назад +3

    Hi mosh this is Arif Billah from bangladesh. Youre my true mentor thank you so much

    • @munjir
      @munjir 4 года назад

      vai cse te poren??

    • @arifbillahsheikh9452
      @arifbillahsheikh9452 4 года назад

      I am a front end web developer now I am learning back end web development by using python Django.
      I would like to be a professional software engineer. Mosh is one of my best teacher.

    • @muhammadfaraz8569
      @muhammadfaraz8569 4 года назад

      @@arifbillahsheikh9452 Salam bahi form which vadio you learn web development in Python.

    • @arifbillahsheikh9452
      @arifbillahsheikh9452 4 года назад

      you can go to playlist of this channel you will see 6 hours python cousre .

  • @smrutiranjanbihari
    @smrutiranjanbihari 4 года назад

    Please make a full tutorial on flutter programming. We really really waiting for that tutorial from a best tutor.

  • @sahilaujla8182
    @sahilaujla8182 4 года назад +1

    Thanks for this

  • @grandmastergyorogyoro532
    @grandmastergyorogyoro532 4 года назад +1

    Time for bubble sort!
    Waiting!!

    • @grandmastergyorogyoro532
      @grandmastergyorogyoro532 4 года назад

      @@programmingwithmosh
      I liked your explanation,it was easy to grasp,
      Thank.you for the wonderful explanation ✌️

  • @Tanyasingh_4
    @Tanyasingh_4 4 года назад

    where can i get the part 1 of this series cause am not familiar with time complexity of algorithms??

  • @kavinbharathi
    @kavinbharathi 3 года назад

    for people trying to do in python :
    ```
    def bubble(arr):
    n = len(arr)
    def swap(arr, i, j):
    arr[i], arr[j] = arr[j], arr[i]
    # print('=>', arr, end=' ')
    for i in range(n - 1):
    for j in range(abs(i - n) - 1):
    if arr[j] > arr[j + 1]:
    swap(arr, j, j + 1)
    # print('j = ' + str(j))
    return arr
    ```
    hope it helps.

  • @testermailer4130
    @testermailer4130 4 года назад

    i have one question . how to protect passport jwt token ? example
    if someone get mytoken variable and copy it into other API like Postman or any other he can access fully backed user data .

  • @eugenenovikov671
    @eugenenovikov671 2 года назад

    if we have flag about swaped or not - can we get rid of two cycles and do only one cycle until flag is true?

  • @siddarth_thiru
    @siddarth_thiru 4 года назад +10

    Mosh when will we get Android development tutorial. Please 😭 (it's been years)

  • @exoticme4760
    @exoticme4760 Год назад

    thnx

  • @ramkumarsenthilnathan8662
    @ramkumarsenthilnathan8662 4 года назад +3

    Make more of algorithms and data structures in java . thank you

    • @ebentee
      @ebentee 4 года назад +2

      You can submit question to him on the post he creat in the community tab. You just have to feel the form with your question

  • @adityapatel7759
    @adityapatel7759 2 года назад

    Great tutorial...Can you please explain how in best case scenario we need a single pass? Because even if array is sorted we have to loop through it to know its sorted so O(n) right?

  • @armanahmed4806
    @armanahmed4806 4 года назад +1

    Sir ur tutorials are amazing plz make a one video on Django plz sir

  • @charmainekylebongon8611
    @charmainekylebongon8611 2 года назад

    Hello @ Programming with Mosh can u help me about Bubble sort at Insertion sort?

  • @brunomauricioavilaperez824
    @brunomauricioavilaperez824 4 года назад +1

    How do you edit your videos? please :D they are really cool

  • @silambarasan.ssethu9367
    @silambarasan.ssethu9367 2 года назад

    Hey Mosh , ur comment about this logic,
    void bubble(int[] arr) {
    int arrLength = arr.length;
    int maxSwapIndex = 0;
    while (arrLength > 0) {
    maxSwapIndex = 0;
    for (int i = 1; i < arr.length; i++) {
    if (arr[i - 1] > arr[i]) {
    swap(arr, i - 1, i);
    maxSwapIndex = i;
    }
    }
    arrLength = maxSwapIndex;
    }
    }

  • @Bandit-is8zi
    @Bandit-is8zi Год назад

    I am proud of myself i menage to make my own sorting algoritham tonight and i didnt even knowing of bubble sort, i write it in c++ and after that asked in discord and actually find out that is my program actually bubble sort

  • @malteeaser101
    @malteeaser101 Год назад

    Funny how I've basically used the bubble sort algorithm my entire life, when mentally sorting lists, without ever knowing there was a name for it

  • @Tanyasingh_4
    @Tanyasingh_4 4 года назад +1

    i reallly wanted to take your course ,, but actually its alot expensive for me to enroll now😶may be I have to look for some other alternative to learn data structures and algorithm

  • @saadkhan7891
    @saadkhan7891 2 года назад

    Sir, I'm your student from Pakistan
    I love your videos so much
    sir the reason for my texting you is a request that can you please upload tutorial about web scraping with python
    i watch many videos on youtube but your method of teaching was too good i really loved it
    can you please do that for your students

  • @freerabiul5255
    @freerabiul5255 Год назад

    you just made it more complez

  • @mohsin5563
    @mohsin5563 4 года назад

    please make a video on link list too on c++

  • @KodiLearn
    @KodiLearn 4 года назад +1

    Please mosh create fully separate django course. I need that. Please mosh I really like your teaching style.

    • @KodiLearn
      @KodiLearn 4 года назад +1

      @@programmingwithmosh Thank you so much for your reply. I am waiting for your course

  • @shashankpandey1019
    @shashankpandey1019 4 года назад +4

    @Mosh course price is too high $147 . Any discount or coupon available ?

    • @matthew11092
      @matthew11092 4 года назад +3

      Shashank Pandey the course is available for $29 right now

    • @shashankpandey1019
      @shashankpandey1019 4 года назад

      @@matthew11092 yuup got it, thank you

  • @abrarhasan4663
    @abrarhasan4663 4 года назад +1

    i want to take your course but i can't afford as i'm only a undergraduate student. will you help me regarding this? i will work hard.

  • @KeifusMathews3
    @KeifusMathews3 4 года назад

    Hello I am looking to start to learn Code, where do I start and what do you recommend i start with first. I see your course on Udemy is that where I should start? Thanks

    • @KeifusMathews3
      @KeifusMathews3 4 года назад

      @@programmingwithmosh Okay will start over the weekend, thank you and wish me luck

  • @AhmedKhan-rt6oz
    @AhmedKhan-rt6oz 4 года назад

    Sir, please make whole series on DevOps

  • @user-yd9xy3rb4x
    @user-yd9xy3rb4x 2 года назад

    According to your code the scheme you showed at the beginning is wrong. Cuz index i(0) will be compared to each element in the array, then i + 1 after that comparison and so on.

  • @jotaro9664
    @jotaro9664 4 года назад

    Saviour is back

  • @ssp3839
    @ssp3839 3 года назад

    sir in the 16 th line we should give static sir public static void swap(int arr[], int index1, int index2)

  • @justagamer5070
    @justagamer5070 4 года назад +1

    What is the program software that you are using?

  • @kirankulkarni04061993
    @kirankulkarni04061993 4 года назад +10

    When are you going to do a series on Cloud??

  • @mithungowdabn324
    @mithungowdabn324 4 года назад

    Hi can you please make a vedio of how to use a macbook Pro, complete ( A-Z ) guide , this would help me a lot please

  • @discreet_boson
    @discreet_boson 4 года назад

    Can you please show a tutorial on how you make your animations

  • @ishtiakahmed6336
    @ishtiakahmed6336 4 года назад

    reminder on..

  • @kobe-dq3uj
    @kobe-dq3uj 2 года назад

    How about if it is descending mosh!

  • @khankashani7387
    @khankashani7387 3 года назад

    Can you do C++ data structures and algorithms????????? Please

  • @hisokamorow6709
    @hisokamorow6709 3 года назад

    Oh, you gorgeous bald bastard! You made me understand this POS sorting in 11 minutes!
    i own you a fucking beer my guy, ty!

  • @hasanfuad6631
    @hasanfuad6631 4 года назад

    Thanks as always! I wish I could see those 9 people who dislike the video.

  • @muhammadfaraz8569
    @muhammadfaraz8569 4 года назад +1

    I will be coder inshallah sir if you upload advance Python and SQL.

  • @amvhouse9905
    @amvhouse9905 4 года назад +1

    In this case why don't we use sort() function in python?

    • @amvhouse9905
      @amvhouse9905 4 года назад

      @@programmingwithmosh hey mosh I'm a fan of your lecture and tnx for replying.but i have a request can u please make a video of popular algorithms for beginners?

  • @saidkamolanvarkhujaev1048
    @saidkamolanvarkhujaev1048 4 года назад

    Laravel
    Complete tutorial please

  • @nishantrohilla5058
    @nishantrohilla5058 4 года назад

    Plz make more videos about phyton plz... Mosh sir.... Plzzz... Make more videos

    • @nishantrohilla5058
      @nishantrohilla5058 4 года назад

      Mor about class and modules I need to make perfect without any error in my programms plz..... Plz..... 🙏🙏