Data Structures & AlgorithmsHardGATE CS · TCS NQT

Which data structure answers range-minimum queries and point updates each in O(log n) time?

  1. A. Plain stack
  2. B. Hash map
  3. C. Sorted linked list
  4. D. Segment tree

Correct answer: D. Segment tree

A segment tree stores minima for ranges in a balanced tree of nodes, so both queries and updates touch O(log n) nodes.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic