[Home]
BubbleSort

| CodeRaptors | Projects | Tips and Scripts | Guides | Links |


Each colored bar represents a list element. The height and color correspond to the value of the element. The green bar signals a read operation and the blue one a write operation.

Virtual time is a rough estimate of the algorithm speed. It can be used to compare the different algorithms on this website, but it's not really a good benchmark. The actual running time of the applet is not related to the virtual time and says nothing about the speed of the algorithm, it is trimmed to make the slower ones bearable to watch and the faster ones possible to see.

The Bubblesort algorithm has complexity O(n^2) which isn't particularly good. The whole idea is to repeatedly go through the list, comparing two elements and swapping them if they are in the wrong order. Thus, elements "bubble up" to their correct place. It's typically a terribly bad choice except for almost sorted lists, but so easy to understand that it is often mentioned in introductory computer science.

More on Bubblesort here.

<< Go back to the sorting algorithms



Search: