02/21/00
COM1100 Winter2000 Yuhong Yin
10
Bubble Sort
nIn a Bubble Sort, we need N-1 passes.
nOn each pass we visit each element, and check whether that element and its immediate neighbor are in order. If they are out of order we switch them before going on. After the first pass through the list at least the largest element will be put in its proper place. After the second pass, at least the largest two elements will be in the right place, and so on. We repeat the process until the whole list is sorted.