#Day9 #100DaysOfCode
bubblesort is the simplest sorting algo. sort elements by swapping adjacent elements. gots its name because the largest element finally bubbles to the end of the array. because adjacent element is swapped, the end of a loop stops at the next to last element. every other loops, the length of array reduces (i.e: j < n-i-1). because computer doesnt know if the array is alr sorted, there's a flag swap introduced when there's no swapping in inner loop.
Came across this cool community and signed up for it!
https://dev.to/qbaocaca
bubblesort is the simplest sorting algo. sort elements by swapping adjacent elements. gots its name because the largest element finally bubbles to the end of the array. because adjacent element is swapped, the end of a loop stops at the next to last element. every other loops, the length of array reduces (i.e: j < n-i-1). because computer doesnt know if the array is alr sorted, there's a flag swap introduced when there's no swapping in inner loop.
Came across this cool community and signed up for it!
https://dev.to/qbaocaca