5 hands-on exercises and 5 find-the-bug challenges for the QuickSelect: the Kth Element Without Sorting lesson. Every one is checked automatically in the browser — write the code, run it, and the tests tell you what still fails.
Find the element at sorted index two and show it.
Show the smallest value using sorted index zero.
Show the largest value by picking the last sorted index.
Partition around the last element and show where the pivot lands.
Copy before selecting and confirm the source is unchanged.
Sorted index two is the third smallest, not the second.
After an ascending sort the largest sits at the end.
Ready to write the code?
The editor, the automatic checks and the worked solutions open up with an account.
Open the workspaceUsing <= lets a value equal to the pivot cross the boundary.
Sorting without copying rearranges the original.
Always taking the first element degrades to a quadratic scan on sorted input.