|
|
|
|
|
by T-hawk
5376 days ago
|
|
Looks like bubble sort is so slow because this implementation has a very high ratio between the costs of a compare and a swap. A swap involves redrawing large parts of the graphical area, while a compare is fast. Bubble sort makes N^2 swaps, as compared to insertion sort which makes N^2 comparisons but only N swaps. When a swap costs the same as a compare, bubble sort is as fast as the other N^2 sorts. |
|