After completing a 30 minutes lecture on the topic this video is like a dessert after dinner.
@SzechSauce5 жыл бұрын
These videos are great, 30mins of my lecture summarized in 2mins lol
@pxolqopt35974 жыл бұрын
30 minutes to explain bubble sort? Really?
@prometheus-naturalscience93712 жыл бұрын
@@mtosity Usually a CS lecture on something like this would also include proofs for correctness, and time and memory complexity. Dont think it adds up to 30 minutes, but its obviously a lot more than what is shown here, which basically just the idea of the algorithm and an example.
@tanveebandi10902 жыл бұрын
True😂
@AnkurSingh-uc7gz2 жыл бұрын
In min😂 2X
@100_focus2 жыл бұрын
wait u guys are learning this in uni???
@r0btaylor2 жыл бұрын
I only recently found your channel and I'm finding your style and clarity to be especially effective for my learning. Just wanted to let you know how much I've been appreciating your content. Thanks!
@MichaelSambol2 жыл бұрын
I appreciate you watching, thank you!
@kewtomrao3 жыл бұрын
His two minutes of silent teaching was better than an hour of our lecturer's class.
@realwizardry8346 жыл бұрын
Love this visual way of learning. Thank you for the work put into this
@lucutes2936 Жыл бұрын
ye
@abzinhoo Жыл бұрын
Ah
@lukebrown2498 Жыл бұрын
Hello, i'm a student from the UK and my course requires me to learn a lot of the sorting algorithms that you have shown. Usually, only resources from people specifically covering the course is helpful, but these visual aids have been really effective and engaging, so thanks so much
@MichaelSambol Жыл бұрын
glad the videos helped! thanks for the note.
@ronitmehta25944 жыл бұрын
I am a visual learner so I found this extremely helpful!
@ichoosemeimsorry Жыл бұрын
lmaoooo i cant believe i managed to understand what i have been struggling with the whole semester in 2 minutes. thanks man
@omersakkar56706 ай бұрын
Thanks for the explination. I wanted to point out that you can right much more effecient code: for i = 0 to n-1 for j = 0 to n-i-2 if array[j] > array[j+1] swap(array[j], array[j+1])
@ravs6 жыл бұрын
Very simple and concise way to explain this algorithm. Keep up the good work and looking forward to more videos.
@Raum_Raum_Raum_Raum4 жыл бұрын
Shush bitch
@Krokodil9865 жыл бұрын
amazing video - short, precise, and explains very well
@eeevoo4 жыл бұрын
@@Raum_Raum_Raum_Raum damn why so toxic
@陳致揚6 ай бұрын
I have watched your all videos several times whenever i need to review the algorithm, " You Are Definitely A God Of Algorithm"
@romysasiddiqui2859 Жыл бұрын
you're videos are more helpful than other videos that are 30 to 40min long and yet at the end still are confused.
@valvarexart8 жыл бұрын
Very nice and to-the-point videos, thank you! A small note: bubble sort would perform better if n was decreased after each iteration (reflecting the fact that the last element is in its final position) and if we keep track of whether swaps have been made or not during a round (if not, we can just terminate).
@stefanjovanic77255 жыл бұрын
I was looking for this explanation that's how simple it is for some people. Two sentences to explain what is going on.
@shalev12345 жыл бұрын
And I think also every even iteration a bubble of small elements to the left will be good for a case that a small element is on the right side of the array.
@jliu66-p1q2 жыл бұрын
the best optimization is setting your outter loop stop index to be the last swapped index of your inner loop. This makes it more naturally adaptive than keeping track of a swaps made boolean
@manmeh4r3 жыл бұрын
now THIS is the best bubble sort guide ever
@farhatzuhair7729Ай бұрын
Thanks, I cleared my exam easily by watching this
@techytech07 Жыл бұрын
Thanks for a clear and simple video! It's Helping for my GCSE this May. Some people just overcomplicate these sort methods.
@NB20LOL3 ай бұрын
Very helpful, have a test in 2 days and know almost everything on this topic
@hydhexane Жыл бұрын
i have exam tomorrow, this video helped me revise bubble , thanks
@MichaelSambol Жыл бұрын
crush it!
@juicetime22210 ай бұрын
I have an exam soon, this video really helped!
@luke95245 жыл бұрын
Incredible video, you're style of teaching is very easy to understand.
@kerbe53743 жыл бұрын
Bruh is this really what took my professor most of the class trying to explain😭 thank you so much for this
@TheGugustar2 жыл бұрын
Best algo channel on youtube.
@priyanshuagrawal92042 жыл бұрын
Thankyou from saving me from watching 1 hour lecture, when I am in rush before exams
@SniperFire2743 жыл бұрын
Best video I've seen to explain bubble sort, thank you!
@chiragshilwant8865 жыл бұрын
According to your code, Number of comparisons is n(n-1) but it can be reduced to n(n-1)/2 by setting j upto n-i-1
@ramviswanadhapalli4397 Жыл бұрын
i was thinking about the same thanks for the confirmation
@FrenziedSol2 жыл бұрын
This animation absolutely made me understand the bubble sort
@JohnWickXD3 жыл бұрын
This channel is underrated man!
@HarunAltay7 жыл бұрын
Thanks Michael. Great job! But I guess pseudu code is wrong. It may be: for (int i = 0; i < array.length; i++) { for (int j = 0; j < array.length - 1 - i; j++) { if (less(array[j + 1], array[j])) exchange(array, j, j + 1); } }
@piyushsahoo3636 Жыл бұрын
yes both are correct but yours is more optimized
@nicolasrodriguez14994 жыл бұрын
Thanks dude, this shorts videos are saving me for my algoritm exam! Thanks!
@MuntahaZad4 жыл бұрын
Thanks! No music and no trash!
@Pwnedby Жыл бұрын
I literally coded it after u explaining it to me. This helped soo much!
@roaamoustafa3488 Жыл бұрын
Hello, i just eant to thank you for you effort in this short videos I have adhd and I always find it so hard to understand CS concepts such as datastructers and long videos don't work for me at all also I am a visual learner so, I'm really thankful!
@MichaelSambol Жыл бұрын
you're welcome!
@Ali-mi9up5 жыл бұрын
Those saying that pseudocodes is wrong are incorrect, you can have another implementation that's right too
@vincenzocammilleri29073 жыл бұрын
All your sort videos were awesome!!! Thank you so much bc I needed it for my final tmw lol
@yikayiyo29206 жыл бұрын
for i from 1 to N: # N-1 iterations to sort a N-length list for j from 0 to N-i: # after i iterations ,the last i elements are sored
@UtshaKSaha5 ай бұрын
This was such a good video, some things just need visualizations.
@hakonaskildsen2602 Жыл бұрын
Thank you so much for amazing videos! Great repetition before exams.
@secretnobody646024 күн бұрын
so much better than my 3 hour lectures
@saddlepiggy Жыл бұрын
Awesome videos, great refreshers before finals
@MichaelSambol Жыл бұрын
💪🏼❤️
@VihaanKumar-o1s10 ай бұрын
excellent explanation.........very simple and easy to understand
@player-vo8yb3 жыл бұрын
i like these short vids to the point and no padding like those other shitty ass vids thank you kind sir
@billionear2 жыл бұрын
Awesome simple and straight to the point - subscribed!
@vendita24 жыл бұрын
Thank u, didnt have time for big explanations
@entruh45204 жыл бұрын
Thanks man. Wish me luck for my test tomorrow
@kingcookie39205 жыл бұрын
the pseudocode works but I would do "N-i" instead of "N-1"
@jesusbojorquez22525 жыл бұрын
N - i - 1
@kingcookie39205 жыл бұрын
@@jesusbojorquez2252 why? i starts with 1. First round you need to compare 6 times. That is N-1 Second you compare 5 times. That is N-2 Overall you have to do this 6 times (Not an insult, I am probably just don't get it)
@jesusbojorquez22525 жыл бұрын
@@kingcookie3920 I wrote N - i - 1 because if you look at the second for it goes from 0 to N -1, so when j == N - 1 it will compare a[N - 1] with a[N] which doesn't exist in the array. "FIrst round you need to compare 6 times" yes that's right but remember that the second for start from 0 so you don't need to go to N-1 you just need to go to N - 2.
@renzserilo71424 жыл бұрын
Just an ordinary boy here just to read these comments, i’m not crazy to argue with a king specially with jesus.
@svenwillett17504 жыл бұрын
You're doing an advanced bubble pass, a normal one still does the rest even though you know the last is known.
@random-03 жыл бұрын
Best video on bubble sort
@MohammadJavadd7 ай бұрын
Finally understand it, thanks so much
@monjasonsteng78614 ай бұрын
This was great. Thank you!
@alexanderhearn6015 Жыл бұрын
I love having to put the video in 2x speed. This should be a 20 second video
@MichaelSambol Жыл бұрын
Go as fast as you need :) I talk slow.
@radhikasoni81055 жыл бұрын
Brilliant explanation!! Please make a video on Radix sort.
@magickomchanell45564 ай бұрын
Very helpful thanks for the video!
@sanadesai134 жыл бұрын
@michael, Thanks for the video, but shouldn't the second FOR loop be "for j from 0 to N-2". i.e till the second last element. Because if it reaches "N-1" i.e the last element then j+1 = N which will give out of bound error.
@RAHULTMNT1002 жыл бұрын
you are correct the values should be, i < nSize - 1 ( as i reaches nSize -1 , array will be sorted) j < nSize - i - 1 ( after i iterations, the last i elements are already sorted)
@CephasTheWanderer5 жыл бұрын
Awesome. Short, sweet, simple
@Erikuri8 ай бұрын
Thank you! This really was helpful.
@cg87704 ай бұрын
Nice video!! It helped me a lot
@nirkiotaxy5 ай бұрын
ООООО, НАКОНЕЦ Я ПОНЯЛ ЭТОТ МОМЕНТ!!! То, что при первом прохождении цикла, большее число однозначно отсортируется и будет стоять в конце массива, из-за чего можно не проводить последующие проверки с ним
@evanspicolo64933 жыл бұрын
Nice video! Helpped I lot to teach this
@ettsoc9018 Жыл бұрын
great and efficient to learn like this
@JamesBrodski3 жыл бұрын
Great video! Thank you so much.
@FunnyOnes1xx Жыл бұрын
this was very helpful, Thank you!
@MichaelSambol Жыл бұрын
De nada!
@이석원-x9p5 жыл бұрын
I like colors you made.
@lindamanas9542 жыл бұрын
Nicely done!
@abdosalah222 жыл бұрын
Great explanation!
@WithmusclecutieАй бұрын
Wouldnt it be more efficient if it didnt look at the number combos that didnt change
@jeshmex2 жыл бұрын
Thank you so much, very helpful!
@prashanthreddy15024 жыл бұрын
The bubble sort method is a nice and simple method of sorting an array. It however looks to be very time consuming and inefficient as it would have to run almost as many times as the size of the array and it would be highly inefficient with larger arrays. #IISH11CSHLIC
@midasredblade2362 жыл бұрын
prolly usefull in special cases
@yblue61162 жыл бұрын
you saved me, thanks a lot man
@lukehatcher984 жыл бұрын
Just what I needed!
@mahdighasemi95183 жыл бұрын
very good, thank you❤️👍
@afaqa.s.98875 жыл бұрын
Simply, awesome...
@jamaicandjnado5 жыл бұрын
Perfection. Thank you.
@minkymoo57733 жыл бұрын
So bubble sort is a bit like the opposite of selection sort, isn't it? Since with selection sort, you have a sorted partition on the left at any given iteration, and with bubble sort you have a sorted partition on the right at any given iteration.
@cravinghydra304 жыл бұрын
Bubble Sort is the simplest sorting algorithm that works by repeatedly swapping the adjacent elements if they are in wrong order and it arranges them in increasing order.#IISH 11CSHLIC
@nty4494 жыл бұрын
my teacher showed us this dumb ass dance thing and I was like WTF IS THIS GARBAGE. this is so much more helpful thank you. I actually get it now
@NyashaMandizvidza-vp3do Жыл бұрын
This is amazing
@ReapeX3 жыл бұрын
Subscribed, thanks!
@ricardoancona97223 жыл бұрын
for an strange reason, running this pseudocode in python has a bug, I don't know why, but comparing 2 elements of the list, for example: 4>23, returns TRUE, because. it seems to be comparing only the first digit (4>2), I solved it by converting the current value and the next value to integer before comparing, does anyone know why this happens?
@JuanArth3784 жыл бұрын
Thank you it was very helpful
@Tim1-z6b Жыл бұрын
Bubble sort Javascript code: function bubbleSort(arr) { for (let i = 0; i < arr.length; i++) { for (let j = 0; j < arr.length - i - 1; j++) { if (arr[j] > arr[j + 1]) { let temp = arr[j]; arr[j] = arr[j + 1]; arr[j + 1] = temp; } } } return arr; }
@memenchance17472 жыл бұрын
I know how to do the problem but I don't know how to tell the computer how long I want this process to continue. Do you have any suggestion of books to read or watch?
@joebradley12397 жыл бұрын
Great video! im doing GCSE computer science and i was just wondering what would an exam style question look like? would it simply ask to sort these numbers using a bubble sort (show your working) or breifly explain what a bubble sort does? thankyou
@antoniojg-b82846 жыл бұрын
In my experience, it's likely the first one.
@ameliewolfbane77336 жыл бұрын
One question might be what will the last two numbers be after the first iteration (the answer would be 1 , 9)
@HabirRibah5 жыл бұрын
You're great. Thank you
@iamusmanshabbir1423 жыл бұрын
Real Gem 💎
@StewieGriffin5 жыл бұрын
Bubblesort is basically the MOST BASIC SORT EVER
@ctoxyz2 жыл бұрын
humans hav voice for reason : nice work
@sean_hare4 жыл бұрын
This psuedocode works, but it's literally doing twice the number of iterations it needs to, and this is wasteful code. It should be: For i = N-1 to 0 For j = 0 to i if a[j] < a[j+1] swap(a[j], a[j+1]) If after the first pass of j, the highest value in the array will be sitting in N. Knowing this, the second pass of j should terminate one space earlier, which will happen when i decrements toward 0.
@mastermax7777 Жыл бұрын
shouldnt the second loop only go until N-i ?
@shafaf14 жыл бұрын
Simple and understandable
@asagiai49653 жыл бұрын
is it me or this is probably the slowest sorting algo? thanks for a more clear explanation
@devops-k1p Жыл бұрын
Currently done with 2h lecture, now time for 2h lab. Leave me alone bubble sort!
@Jschmuck8987 Жыл бұрын
so, essentially, the worst case scenario is where it's already sorted but in reverse order, right?
@riyamani81614 жыл бұрын
#IISH 11CSHLIC The video helped me understand the process of bubble sorting and how the iteration works. It is a comparison of consecutive variables that gives the right form of number as the end result.
@DeepankSingh-u4p Жыл бұрын
Hi Michael. Which software do you use for the animations in your videos?
@MichaelSambol Жыл бұрын
Keynote and iMovie!
@DeepankSingh-u4p Жыл бұрын
@@MichaelSambol okay. Thanks.
@amandasun6677 Жыл бұрын
Small typo: I believe in the pseudocode, the j loop should be from 0 to N-i
@varunbe093 жыл бұрын
From @interviewkickstart I learned that, Its start comparison from right to left. So second for loop, For j from N to i Everything looks similar but here heavy element sorted at right. And Interviewkickstart video , in every steps lighter elements sorted at left
@lebogangsekwati4305 Жыл бұрын
God bless you!
@adithyam32022 жыл бұрын
im confused how you go from 1 to n and then from 0 to n-1. The smallest index in the array is 0, and the largest index in the array is n-1, right? so how can you go from index 1 to index n when index n does not exist?