Custom Comparator Playground
Playgrounds & SimsEasyVerify custom comparator rules and stable sort invariants.
Alt+Shift+C
Configuration Panel
Comparator Rule
Sorted Output Records Visualizer
Original Input Records Sequence
Sorted Output Records Sequence
Time Complexity
O(N log N) comparison sort runtime
Space Complexity
O(N) record storage
Conceptual Overview
A Custom Comparator defines user-specified sorting rules. A Stable Sort guarantees that elements with equal keys retain their relative original order in the output.
Algorithm Idea
A comparator function compares two elements, returning a negative number if the first element should sit before the second, positive if after, and zero if equal.
Stable Sorting
N/A
In-place Memory
N/A
Source: CP-Algorithms search & sorting reference