Bubble Sort Algorithm | Java | Python | Javascript

แชร์
ฝัง
  • เผยแพร่เมื่อ 1 ธ.ค. 2024
  • In this video you will learn how to implement the bubble sort algorithm using Java, Python and Javascript.
    Data structures and algorithms is a must if you want to become a real software engineer.
    It tough not gonna lie, but I got your back
    ► Courses Available for free here - amigoscode.com...
    ► Join Private Facebook Group - bit.ly/2FbuIkx
    ► Join Discord - bit.ly/2wL029v
    🙊 Here are the goods for all my videos video:
    ► Recommended Books
    Clean Code
    amzn.to/2UGDPlX
    HTTP: The Definitive Guide
    amzn.to/2JDVi8s
    Clean Architecture
    amzn.to/2xOBNXW
    ► Computer and Monitor
    New Apple MacBook Pro
    amzn.to/3464Mmn
    Dell 27 INCH Ultrasharp U2719D Monitor
    amzn.to/2xM3nW1
    Double Arm Stand Desk Mount
    amzn.to/3aYKKfs
    USB C Hub Multiport Adapter
    amzn.to/2Jz7NlL
    ► Camera Gear
    Sony ILCE7M3B Full Frame Mirrorless Camera
    amzn.to/346QIJn
    Sigma 16 mm F1.4 DC DN
    amzn.to/2wbic3Q
    Sigma 33B965 30 mm F1.4 DC DC
    amzn.to/39G37Fd
    Awesome Screen Saver
    github.com/Joh...
    IDE I use for coding
    Iterm
    VsCode
    GoLand
    IntelliJ
    Sublime
    💯 You can also follow me here:
    ► Don't forget to subscribe | bit.ly/2HpF5V8
    ► Join Closed Facebook Group for discussion and early access videos and courses | bit.ly/2FbuIkx
    ► Follow me on Instagram | bit.ly/2TSkA9w
    ► Join Discord - bit.ly/2wL029v
    Channels I recommend to learn how to code
    ► / filipgrebowski | Frontend and JS
    ❤️ Thanks for watching
    #coding #bubblesort #algorithms

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

  • @helaolange
    @helaolange 4 ปีที่แล้ว +44

    Please upload more videos about *Data Structures and Algorithms*

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

      YES! Please amigo upload more content on this, understanding DS & Algortihms is hard sometimes, greetings from Costa Rica

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

      I support! Please more videos about Data Structures & Algorithms in Java. And of course nore videos about design patterns.

  • @hubbiemid6209
    @hubbiemid6209 4 ปีที่แล้ว +12

    Make more data structures and algorithms vids, this was one was super helpful!

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

    At the end, in pyhton, I think that there is a mistake, it is necessary other line code; if list[j] > list[j+1]: like that:
    list = [6, 4, 5, 9, 3, 2, 1]
    print(list)
    for i in range(0, len(list)-1):
    for j in range(0, len(list) -1 - i):
    if list[j] > list[j+1]:
    list[j], list[j+1] = list[j+1], list[j]
    print(list)

    • @DavilaSombre
      @DavilaSombre 3 ปีที่แล้ว

      Thank you! Thats correct. I wonder how he gets correct results...

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

    Thanks for the video! Just to add the if statement:
    list = [11, 20, 53, 78, 41, 65, 8, 95, 13, 5]
    print(list)
    for i in range(0, len(list) -1):
    for j in range(0, len(list) -1 -i):
    if list[j] > list[j+1]:
    list[j], list[j+1] = list[j+1], list[j]
    print(list)

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

      Yeah forgot it for python 🐍 thanks

  • @midasama3124
    @midasama3124 4 ปีที่แล้ว +7

    I know it must be pretty intuitive for you at this point, but it would have been great if you could have spoken a little bit about the time and space constraints we face by implementing this algorithm. Maybe you can take into account for the next videos in this series. Apart from that, nice video! Thanks for the effort.

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

      Yes i don’t want to talk about it yet. After couple more. It will make more sense for many

  • @ericcourville
    @ericcourville 4 ปีที่แล้ว +7

    I didn't just click like, I freakin' SMASHED it!

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

    Just started watching your videos, grateful to have people like you, thanks for all the things you share!!

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

    I love this channel, high quality and well explained!!

  • @tiagoamp6540
    @tiagoamp6540 4 ปีที่แล้ว +11

    Actually, in the python implementation you've missed the IF statement, so the result was not correct. Great video anyway, nice teaching skills, congratz!

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

      Exactly, I thought I am the only one who was thinking, why he hasn't added the 'if' logic. Huffffffff, now I can sleep peacefully.

  • @husein_alfil
    @husein_alfil 3 ปีที่แล้ว

    Would you like to do more videos about algorithms ?
    Thank you in advance !

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

    very clean, very beautiful representation of the algorithm... thank you

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

    for anyone, who was confused or had doubt for the python code, you can refer the below code:
    ls = [6,4,5,3,2,1]
    print(ls)
    for i in range(0,len(ls)-1):
    for j in range(0,len(ls)-1-i):
    if ls[j] > ls[j+1]:
    ls[j+1], ls[j] = ls[j], ls[j+1]
    print(ls)
    You are welcome
    _gareeb Coder

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

    You nailed it Nelson. Shukhran

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

    in The one you did with the python,there is a mistake in output.the output should be [1,2,3,4,5,6] but it is [1,2,3,5,4,6]

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

    upload more videos on Data Structures and Algorithms
    in Javascript

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

    We need more of these kind of videos pls.🙏

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

    would love to see more videos on algorithms with JavaScript c:

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

    Nice! One more optimisation you could do :
    Add *boolean isSorted;*
    So, if the array is already sorted then don't check all these conditions over and over again.

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

    Even though I'm familiar with Bubble Sort, (the worst sorting algorithm out there), this video was a very good explanation of the algorithm. Even if commercially and in interviews, this algorithm should never, ever be used!!
    Looking forward to your upcoming Data Structures and Algorithms course, Nelson. I sadly only know the worst algorithms at the moment! :-P

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

    In the inner loop, you are swapping adjacent elements if the left element is greater than the right element. However, you are doing this for all the elements in the list, even if they are already sorted, which causes unnecessary swaps and an incorrect sorting result.
    To fix this issue, you need to add a flag to check whether any swaps were made in the previous iteration of the outer loop. If no swaps were made, then the list is already sorted and you can exit the loop. atleast for the python version of your code :)

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

    More data structure and algorithms please. I really like the way you explain.

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

    You are amazing in explain
    Your explain is fantastic 💗

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

    Nice brother , As a cs teacher this is a great resource and practical demo.

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

      Oh 😊 thank you teacher

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

    This guy is a great teacher

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

    One correction which I know it was a mistake , first let me commend you for all the good work and the time taken to put up this educative contents. So on the python solution you forgot to do a check on the index and values, you did this base on the fact that you already know the value and index of the element in the list. It will be great if you can review and correct this so that it doesn't bring confussion.Thanks

  • @KrishnaYadav-zu5oz
    @KrishnaYadav-zu5oz 4 ปีที่แล้ว

    Very useful . Now my bubble sort concept clear thanks brother .
    Please upload more small videos on data structures .its easy to learn and its not take much time 😀😀

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

    Python sample is not correct!!! Where if list[j]>list[j+1]: ????

  • @phucnguyen0110
    @phucnguyen0110 3 ปีที่แล้ว

    Here's the Python If statement (in case anyone doesn't want to bother)
    if list[j] > list[j+1]
    temp = list[j]
    list[j] = list[j+1]
    list[j+1] = temp

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

    Damn you are Good!!! Smashing the like button!!!

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

    It´s funny to see how it´s implemented in Python... more clean

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

    I think that in the python example you forgot the If statement, since the array wasn't sorted correctly. Great video anyways go on!

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

    Python code looks neat. Nelson what’s your favorite backend language?

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

    Very good content, can't wait for the next video on algorithms.

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

    Awesome job there. Keep it going

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

    cool bro iam one of your subcriber from uzbekistan

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

    nice video. Gud expplanation
    but the output of python program shown is wrong can you check it at 17:32 . It shows [1,2,3,5,4,6]

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

      He forgot to add the check of:
      if list[j] > list[j+1]:
      after line 4

  • @sandile13809
    @sandile13809 3 ปีที่แล้ว

    Does python recognize when your swapping array elements? If so is that why you don’t need temp variable?

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

    Thank you Nelson 😊 keep it up 👍

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

    For sure more videos on python please

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

    Nice! I like the video. Hey what theme are you using for your visual studio code?

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

    Please do more Java data structures

  • @Learner-1xd
    @Learner-1xd 9 หลายเดือนก่อน

    16:38 : Hi! Brother I think there is a small mistake in the python implementation of bubble sort. You accidentally forgot the (if) condition part.😊

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

    Really helpful thanks

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

    You can use for each to semplificat the code but good work and how you tell the language it's just a tools, Thanks

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

    Upload more videos about DS and algorithms (python)

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

    Hey! Can someone tell me how to create similar explanatory diagrams on a computer, like what software should I use?

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

    Assalamu Aleykum wa rohmatullohi wa barakatuh bro!
    BubbleSort.py
    # just 2 lines of code!
    list = [ 6, 4, 5, 3, 2, 1] [::-1]

    print(list)
    Result :
    [1, 2, 3, 5, 4, 6]
    P.S PYTHON THE BEST !

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

    Thanks for the video. Could you please say your vscode theme?

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

    In Python the result was [1,2,3,5,4,6] ?

  • @mohammedirfaan3836
    @mohammedirfaan3836 3 ปีที่แล้ว

    As-salamu alaykum amigoscode
    for some kind of different list elements. your python code doesnot work
    for example
    list=[11,10,3,2,1]
    print(list)
    for i in range(0,len(list)-1):
    for j in range(0,len(list)-1-i):
    if(list[j]>list[j+1]):
    list[j],list[j+1]= list[j+1],list[j]
    print(list)

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

    Possible you'd do a Java masterclass in the future?

  • @44erdemd44
    @44erdemd44 4 ปีที่แล้ว

    Nice 👌🏻, could you also make a video about the big O notation

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

      Yes but let go over some algo first

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

    Thank you, sir!

  • @renatorobles7440
    @renatorobles7440 3 ปีที่แล้ว

    Thanks ! 👏❤️👍🏻

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

    I never seen someone write a "for" loop like that. Interesting. Lol

  • @FordExplorer-rm6ew
    @FordExplorer-rm6ew 4 ปีที่แล้ว

    Every big domain like FB and discord are connected.
    I know http fairly well but the scope of this is beyond me.
    Btw the sub bot hack is a "puzzle," look into who made it.
    People who are doing the TH-cam sub bot hack have mentioned this.
    That every domain is connected in some kind of way.
    I have a feeling people are using discord integrations and an exploit to view everyone's social media info.
    I can't really explain more than that because I've been physically harmed and threatened for talking about it.

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

    What about sorting names by alphabetical order?

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

    As-salamu Alaykum! In python, you've just reversed the array! you forgot if statement! anyway good job 👍

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

    thank you!

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

    Hey just wanted to flag that the Facebook Group Link in the description is clipped! link doesn't go to the group itself.

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

    Assalamualaikum,
    Have you joined in your new job?

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

    hi the link of the group is not accessible

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

      ► Join Private Facebook Group - bit.ly/2FbuIkx

  • @erfantaghvaei2203
    @erfantaghvaei2203 3 ปีที่แล้ว

    The python version is not implemented correctly my brother, you forgot the if statement for checking if the value is actually larger before the swap operation

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

    Web developer which language starting first

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

    please more

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

    Vs Code theme?

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

    Please the vscode theme

  • @truongnguyenquang303
    @truongnguyenquang303 3 ปีที่แล้ว

    some wrong bbsort in python, i seen that 1, 2, 3, 5, 4, 6 on 17:53 ^^.

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

    Python code is wrong....the list was not sorted..your code should include " if list[j]>list[j+1]: "

  • @SonuSingh-qw2bs
    @SonuSingh-qw2bs 4 ปีที่แล้ว

    The thing that i didn't understood is limit 😥

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

    first like...👍

  • @Kyle-kn8ye
    @Kyle-kn8ye 4 ปีที่แล้ว +1

    Your implementation in Python is incorrect.

  • @doctorrex7086
    @doctorrex7086 3 ปีที่แล้ว

    Muslim Ma shaa Allah! I want to learn programming)

  • @rushisharma1222
    @rushisharma1222 3 ปีที่แล้ว

    python bubble sort is not proper

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

    Software engineering need math? And tell me your salary and your company thanks