Since a Segment Tree is a binary tree, a simple linear array can be used to represent the Segment Tree. https://leetcode.com/articles/a-recursive-approach-to-segment-trees-range-sum-queries-lazy-propagation/ https://www.hackerearth.com/zh/practice/data-structures/advanced-data-structures/segmen...
Building an O(n^2) segment tree is very expensive, your implementation took O(n^2) just to build the tree. Sparse table can be built in the same speed and compute rmq in O(1), as opposed to O(logn). The only advantage this 2D segment tree still has over the sparse table is O(...
hello everybody. I currently learned the segment tree algorithm and it is a bit diffucult to understand this. I really need help to provide better understand and implementation . What would you advise for me to get this ? thank u