DDSA Solutions

Ordered Set

14 problems · 5 with full explanations

1 Easy3 Medium3 Hard
An ordered set (e.g., SortedSet<T> in C#) maintains elements in sorted order with O(log n) insert/delete/lookup. Use it when you need both fast membership testing and order-based queries (floor, ceiling, predecessor, successor).

How to practice

To practice Ordered Set problems effectively, start with the Easy problems listed below, trace through each solution on paper, then re-implement without looking. When you can recognise the ordered set pattern within 30 seconds of reading a new problem, move on to Medium difficulty. Use the related topic pages and our study guide for a structured progression.

Open the full study guide →

All Ordered Set problems