Introduction to Segment Trees

Learn how segment trees can be useful in solving coding interview problems.

What is a segment tree?

A segment tree is a full binary tree where each node represents an interval. Generally, a node would store one or more properties of an interval that can be queried later. Look at the illustration below to get a sense of how a segment tree is structured.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.