Back to Series

Conquering DSA patterns

2 articles
NaN reads
3
Segment Tree: Introduction
segment-treeDSA

Segment Tree: Introduction

You might have solved problems that involve ranges and multiple queries, like finding the sum or minimum in a subarray repeatedly.If you’ve ever thought, “There must be a faster way than recalculating everything each time…” then Segment Tree is the...

6 min
10/5/2025
Segment Tree: Range update with lazy propagation
segment-treeDSA

Segment Tree: Range update with lazy propagation

When moving from a normal segment tree to a lazy segment tree, the main goal is to support efficient range updates. In a standard segment tree, updating a range [l, r] requires visiting every affected leaf node, which is O(n) in the worst case. Lazy ...

4 min
10/5/2025