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
Please upload more videos about *Data Structures and Algorithms*
YES! Please amigo upload more content on this, understanding DS & Algortihms is hard sometimes, greetings from Costa Rica
I support! Please more videos about Data Structures & Algorithms in Java. And of course nore videos about design patterns.
Make more data structures and algorithms vids, this was one was super helpful!
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)
Thank you! Thats correct. I wonder how he gets correct results...
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)
Yeah forgot it for python 🐍 thanks
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.
Yes i don’t want to talk about it yet. After couple more. It will make more sense for many
I didn't just click like, I freakin' SMASHED it!
Just started watching your videos, grateful to have people like you, thanks for all the things you share!!
I love this channel, high quality and well explained!!
Actually, in the python implementation you've missed the IF statement, so the result was not correct. Great video anyway, nice teaching skills, congratz!
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.
Would you like to do more videos about algorithms ?
Thank you in advance !
very clean, very beautiful representation of the algorithm... thank you
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
You nailed it Nelson. Shukhran
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]
upload more videos on Data Structures and Algorithms
in Javascript
We need more of these kind of videos pls.🙏
would love to see more videos on algorithms with JavaScript c:
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.
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
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 :)
More data structure and algorithms please. I really like the way you explain.
You are amazing in explain
Your explain is fantastic 💗
Nice brother , As a cs teacher this is a great resource and practical demo.
Oh 😊 thank you teacher
This guy is a great teacher
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
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 😀😀
Python sample is not correct!!! Where if list[j]>list[j+1]: ????
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
Damn you are Good!!! Smashing the like button!!!
It´s funny to see how it´s implemented in Python... more clean
I think that in the python example you forgot the If statement, since the array wasn't sorted correctly. Great video anyways go on!
Python code looks neat. Nelson what’s your favorite backend language?
Very good content, can't wait for the next video on algorithms.
Thanks
Awesome job there. Keep it going
Thanks
cool bro iam one of your subcriber from uzbekistan
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]
He forgot to add the check of:
if list[j] > list[j+1]:
after line 4
Does python recognize when your swapping array elements? If so is that why you don’t need temp variable?
Thank you Nelson 😊 keep it up 👍
For sure more videos on python please
I will
Nice! I like the video. Hey what theme are you using for your visual studio code?
Please do more Java data structures
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.😊
Really helpful thanks
You can use for each to semplificat the code but good work and how you tell the language it's just a tools, Thanks
Upload more videos about DS and algorithms (python)
Hey! Can someone tell me how to create similar explanatory diagrams on a computer, like what software should I use?
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 !
This is not sorted...
Thanks for the video. Could you please say your vscode theme?
In Python the result was [1,2,3,5,4,6] ?
Yeah i forgot the if statement
I saw it
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)
Possible you'd do a Java masterclass in the future?
Yes
Nice 👌🏻, could you also make a video about the big O notation
Yes but let go over some algo first
Thank you, sir!
Thanks ! 👏❤️👍🏻
I never seen someone write a "for" loop like that. Interesting. Lol
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.
What about sorting names by alphabetical order?
As-salamu Alaykum! In python, you've just reversed the array! you forgot if statement! anyway good job 👍
thank you!
Hey just wanted to flag that the Facebook Group Link in the description is clipped! link doesn't go to the group itself.
Assalamualaikum,
Have you joined in your new job?
hi the link of the group is not accessible
► Join Private Facebook Group - bit.ly/2FbuIkx
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
Web developer which language starting first
Html css JavaScript
please more
Vs Code theme?
Please the vscode theme
some wrong bbsort in python, i seen that 1, 2, 3, 5, 4, 6 on 17:53 ^^.
Python code is wrong....the list was not sorted..your code should include " if list[j]>list[j+1]: "
The thing that i didn't understood is limit 😥
first like...👍
Your implementation in Python is incorrect.
Muslim Ma shaa Allah! I want to learn programming)
python bubble sort is not proper
Software engineering need math? And tell me your salary and your company thanks