Data Structures & AlgorithmsHardCodeforces Div2 D · data structures

Problem: Which property does an 'order statistics' tree support in addition to search?

  1. A. Constant-time insertion only
  2. B. Finding the k-th smallest element and the rank of a value in O(log n)
  3. C. Finding shortest paths
  4. D. Computing gcd

Correct answer: B. Finding the k-th smallest element and the rank of a value in O(log n)

Each node stores subtree sizes, so rank and select take O(log n) in a balanced tree.

More Coding Interview Problems questions

Exams that ask this topic