Posted by CornedBee

I don't quite get what you mean by first, second and third element. The sort algorithm will call the comparison function as needed. It might compare any two elements of the sequence.
But shouldn't as needed be for every element? Wouldn't each element have to be compared to each subsequent element or how else would be able to determine it's equality compared to the others?