I am given the following invariant:
Invariant
The greatest $i$ keys of an Array are always in sorted order on the last $i$ indices of the Array.
I am supposed to create a sorting Algortihm using this invariant. But I seem to have understood the concept of an Invariant differently, because with the information I find online, I can't find an idea for starting this problem. Do I have to create an algorithm that sorts the first $n-1$ elements in the array? Thanks for your help