Segment TreeLast Updated : 26 Sep, 2023ReadDiscussCoursesIn computer science, a Segment Tree, also known as a statistic tree, is a tree data structure used for storing information about intervals, or segments. It allows querying which of the stored segments contain a given point. It is, in principle, a static structure; that is, it’s a structure that cannot be modified once it’s built. A similar data structure is the interval tree.A segment tree for a set I of n intervals uses O(n log n) storage and can be built in O(n log n) time. Segment trees support searching for all the intervals that contain a query point in time O(log n + k), k being the number of retrieved intervals or segments.What is Segment TreeIntroduction:Segment Tree meaning in DSAIntroduction to Segment Trees – Data Structure and Algorithm TutorialsPersistent Segment TreeSegment tree | Efficient implementationIterative Segment TreeRange Sum and Update in Array : Segment Tree using StackDynamic Segment TreesApplications, Advantages and Disadvantages of Segment TreeLazy Propagation:Lazy Propagation in Segment TreeLazy Propagation in Segment Tree | Set 2Flipping Sign ProblemRange Queries:Queries to check if any non-repeating element exists within range [L, R] of an ArrayRange Minimum QueryQuerying maximum number of divisors that a number in a given range hasMin-Max Range Queries in ArrayRange LCM QueriesNumber of primes in a subarray (with updates)Range query for Largest Sum Contiguous SubarrayRange Queries for Longest Correct Bracket SubsequenceMaximum Occurrence in a Given RangeQueries to find maximum product pair in range with updatesRange and Update Query for Chessboard PiecesString Range Queries to find the number of subsets equal to a given StringBinary Array Range Queries to find the minimum distance between two ZerosQueries to evaluate the given equation in a range [L, R]Find element with maximum weight in given price range for Q queriesSome interesting problem on Segment Tree:Length of Longest Increasing Subsequences (LIS) using Segment TreeMaximize length of longest subarray consisting of same elements by at most K decrementsGenerate original permutation from given array of inversionsMaximum of all subarrays of size K using Segment TreeBuild a segment tree for N-ary rooted treeLength of Longest Subarray with same elements in atmost K incrementsCount number of increasing sub-sequences : O(NlogN)Calculate the Sum of GCD over all subarraysCartesian tree from inorder traversalLIS using Segment TreeReconstructing Segment TreeData Structure and Algorithms CourseRecent articles on Segment TreeIf you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above