Discussion
Sorting an array that is initially in reverse sorted order
is an interesting case because it is common in practice
and it brings out worse-case
behavior for insertion sort, bubble sort,
and shell sort.
Directions
- Click on
to restart the animations.
- Click on a size number to change the size of the examples.
- Click on a cell to restart an individual animation.
- Click on a cell title to explore that algorithm.
Key
-
Black values are sorted.
-
Gray values are unsorted.
-
A red triangle marks the algorithm position.
-
Dark gray values denote the current interval (shell, merge, quick).
-
A pair of red triangles marks the left and right
pointers (quick).