Range Queries
- Queries to check if any non-repeating element exists within range [L, R] of an Array
- Range Minimum Query
- Querying maximum number of divisors that a number in a given range has
- Min-Max Range Queries in Array
- Range LCM Queries
- Number of primes in a subarray (with updates)
- Range query for Largest Sum Contiguous Subarray
- Range Queries for Longest Correct Bracket Subsequence
- Maximum Occurrence in a Given Range
- Queries to find maximum product pair in range with updates
- Range and Update Query for Chessboard Pieces
- String Range Queries to find the number of subsets equal to a given String
- Binary Array Range Queries to find the minimum distance between two Zeros
- Queries to evaluate the given equation in a range [L, R]
- Find element with maximum weight in given price range for Q queries
Segment Tree
Segment Tree is a versatile data structure used in computer science and data structures that allows efficient querying and updating of intervals or segments of an array. It is particularly useful for problems involving range queries, such as finding the sum, minimum, maximum, or any other operation over a specific range of elements in an array. The tree is built recursively by dividing the array into segments until each segment represents a single element. This structure enables fast query and update operations with a time complexity of O(log n), making it a powerful tool in algorithm design and optimization.
Table of Content
- What is Segment Tree?
- Applications of Segment Tree
- Basics of Segment Tree
- Lazy Propagation
- Range Queries
- Some interesting problem on Segment Tree