Specific relative order for equal keys in a Quick Sort problem that explicitly allows instability
The problem statement describes a Quick Sort partition scheme (right-most pivot; < pivot left; >= pivot right) and explicitly notes the output is “not necessarily stable.” However, the judge appears to require an exact ordering among elements with equal keys, causing correct Quick Sort implementations to fail.
Input
pairs=[(5,"apple"), (9,"banana"), (9,"cherry"), (1,"date"), (9,"elderberry")]
Observed (My Output)
[(1,"date"), (5,"apple"), (9,"cherry"), (9,"banana"), (9,"elderberry")]
Expected (Platform Output)
[(1,"date"), (5,"apple"), (9,"elderberry"), (9,"cherry"), (9,"banana")]
Actual behavior
Submission is marked incorrect unless the equal-key elements (key=9) appear in the judge’s preferred order.
Expected behavior
Any output that:
- is sorted by key ascending, and
- follows the stated partition rule (< pivot left, >= pivot right),
should be accepted — without enforcing a particular relative order among equal keys.