Worst: n^2 log n Average: n^2 log n Best: n log n
@fungamer2 did all the work, I had to copy the code for this to work to my unfortunate horror