Step 5 of 6
Stability and custom comparators
A sort is stable if equal elements keep their original relative order. It matters when sorting records by one key after another, or when the input order means something (like arrival time).
std::sort: not stable, usually slightly fasterstd::stable_sort: stable
A comparator must be a strict weak ordering: return true only when a should come strictly before b. Using <= instead of < breaks this rule and is undefined behavior; with std::sort it can even crash.
Your turn: write void rank(std::vector<Entry>& v) that orders entries by score, highest first. Entries with equal scores must stay in their original (sign-up) order.