← All problemsSign in

Sorting

CodeChefRating 2650Open on judge ↗

Alice uses the following pseudocode when she needs to sort a permutation of N positive integers: procedure Sort(list A) defined as: list less, greater if length(A) A pivot := A(length(A)+1) / 2 for i := 1 to length(A) do: Increment(comparison_count) if Ai pivot then append Ai to less else if Ai > pivot append Ai to greater end if end for return concatenate(Sort(less), pivot, Sort(grea

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start