Some more benchmarks on the optimized version of Circlesort (0.5 log2(n) iterations, followed by insertionsort).
- Quicksort is very good at avoiding swaps;
- CircInsert is much better in taking advantage of largely sorted arrays (especially inverted);
Random
Quick
# of swaps: 154
# of inserts: 0
# of shifts per insert: 0
# of comparisons: 1128
Circinsert
# of swaps: 371
# of inserts: 98
# of shifts per insert: 1
# of comparisons: 1274
One out of order
Quick
# of swaps: 99
# of inserts: 0
# of shifts per insert: 0
# of comparisons: 4950
Circinsert
# of swaps: 60
# of inserts: 98
# of shifts per insert: 0
# of comparisons: 1206
Reverse
Quick
# of swaps: 100
# of inserts: 0
# of shifts per insert: 0
# of comparisons: 7085
Circinsert
# of swaps: 50
# of inserts: 0
# of shifts per insert: 0
# of comparisons: 712
Sorted
Quick
# of swaps: 91
# of inserts: 0
# of shifts per insert: 0
# of comparisons: 9307
Circinsert
# of swaps: 0
# of inserts: 0
# of shifts per insert: 0
# of comparisons: 356
Sorted halfs
Quick
# of swaps: 150
# of inserts: 0
# of shifts per insert: 0
# of comparisons: 3791
Circinsert
# of swaps: 155
# of inserts: 98
# of shifts per insert: 0
# of comparisons: 1205
Reverse sorted sequences
Quick
# of swaps: 163
# of inserts: 0
# of shifts per insert: 0
# of comparisons: 1986
Circinsert
# of swaps: 254
# of inserts: 98
# of shifts per insert: 0
# of comparisons: 1195
Sorted sequences
Quicksort
# of swaps: 163
# of inserts: 0
# of shifts per insert: 0
# of comparisons: 1086
Circinsert
# of swaps: 275
# of inserts: 98
# of shifts per insert: 0
# of comparisons: 1225