Segment Tree
A Segment Tree is a data structure used for storing intervals or segments. It allows for efficient querying and updating of information over an array, particularly for range queries like sum, minimum, or maximum. The tree is built in a way that each node represents a segment of the array, enabling quick access to aggregated data.
The construction of a Segment Tree typically takes O(n) time, and it allows for both query and update operations to be performed in O(log n) time. This makes it particularly useful in scenarios where the data is frequently updated, such as in competitive programming or real-time data analysis.