The script visualizes 10 common sorting algorithm. The implemented algorithms and their time complexity are reported in the table below. To visualize the algorithms, simply run the script and specify the array length and algorithm.
Algorithm | Best | Average | Worst |
---|---|---|---|
Pigeonhole Sort | - | O(n+N) | O(n+N) |
Merge Sort | n log n | n log n | n log n |
Heap Sort | n log n | n log n | n log n |
Quick Sort | n log n | n log n | n2 |
Insertion Sort | n | n2 | n2 |
Bubble Sort | n | n2 | n2 |
Gnome Sort | n | n2 | n2 |
Comb Sort | n log n | n2 | n2 |
Selection Sort | n2 | n2 | n2 |
Bogo Sort | n | (n+1)! | (n+1)! |