Before we implement the Bubble Sort algorithm in a programming language, let's manually run through a short array only one time, just to get the idea. Step 1:We start with an unsorted array. [7,12,9,11,3] Step 2:We look at the two first values. Does the lowest value come first?
The Bubble Sort algorithm goes through an array of nn values n−1n−1 times in a worst case scenario.The first time the algorithm runs through the array, every value is compared to the next, and swaps the values if the left value is larger than the right. This means that the ...