Question: how bubble sort algorithm works?
Answer: Instead of searching an array as a whole, the bubble sort works by comparing adjacent pairs of objects in the array. If the objects are not in the correct ordered, they are swapped so that the largest of the two moves up. ... The swapping continues until the whole array is in the correct order.