🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Segment Tree and Fenwick Tree: all 10 questions

Quiz: Segment Tree and Fenwick Tree · Question 10 of 10

When is a segment tree a better choice than a Fenwick tree?

When is a segment tree a better choice than a Fenwick tree?

  1. A.When the array never changes
  2. B.When you only need prefix sums
  3. C.When memory must be as small as possible
  4. D.When you need range minimum or maximum with updates
Answer & explanation

Correct answer: When you need range minimum or maximum with updates

A Fenwick tree handles sums easily, but min and max over any range need a segment tree.

Can you get the rest right without peeking?

Take the timed Quiz: Segment Tree and Fenwick Tree quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →