This is a visualization of a classic sorting algorithm - BUBBLE SORT using JavaScript.
- Open index.html inside of 'empty-example' to view the sorting.
- See 'sketch.js' to view the source code.
It is one of the simplest sorting algorithm which compares two elements in the list and sorts then accordingly.
In each iteration the largest(or smallest) element bubbles upto the top and hence referred as Bubble Sort. The sorting happens until all the elements in the list are sorted.
It has the worst case time complexity of O(n * n).
It is an inplace sorting algorithm.
References
Bubble Sort - Geeks for Geek
Bubble Sort - Wikipedia