
Segment Tree implementation in Golang
This article describes an advanced data structure called Segment Tree and provides implementation in the popular modern language Golang. We will solve a problem in SPOJ to show how we can use the Segment Tree in competitive programming. General Idea Segment Tree is an advanced tree data structure that allows you to answer range queries efficiently and modify the array quickly. Segment Tree is commonly used in competitive programming to solve problems in O(n log n) time. That includes finding the sum of consecutive array elements, minimum or maximum in the range, maximum consecutive range sum, etc. This structure is more flexible than Fenwick Tree and allows you to solve more complex problems but is more challenging in implementation. ...
