← All topics
Quiz: Segment Tree and Fenwick Tree: questions with answers
10 questions, each with the answer and a short explanation.
Take the timed quiz + get a certificate →- Q1. Why are plain prefix sums a poor choice when values change often?
- Q2. In a segment tree, what does each node store?
- Q3. During a query, what does a node do if its range is completely inside [L..R]?
- Q4. What does this print? (code)
- Q5. In a segment tree for range minimum, what should a completely outside node return?
- Q6. What does this print? (code)
- Q7. In a Fenwick tree, which T entries are added to get prefix(7)?
- Q8. What does this print? (code)
- Q9. Why must a Fenwick tree use 1-based indexes?
- Q10. When is a segment tree a better choice than a Fenwick tree?