Matrix sort demonstration

Demonstration of quicksort modified for vector or string comparisons, as mentioned in Sedgewick's Algorithms in C++. All bugs and mistakes are my own...

This code solves the problem of removing all duplicate rows from a square matrix by first sorting the rows, then using the sorted result to find the first instance of each unique row in the matrix.

The goal was to improve the best case of the algorithm. For this algorithm, the "run all random" is the best case, because given enough columns and unique values, the sort won't have to even look at many of the values in the matrix. The worst case is the "run equal until last column", because every value in the matrix is examined, and the last column will take some time to sort.

Here is the code.

rows
columns
num unique (for non-constant cases)