MCPcopy Create free account
hub / github.com/TheAlgorithms/Go / SegmentTree

Struct SegmentTree

structure/segmenttree/segmenttree.go:17–21  ·  view source on GitHub ↗

SegmentTree represents the data structure of a segment tree with lazy propagation

Source from the content-addressed store, hash-verified

15
16// SegmentTree represents the data structure of a segment tree with lazy propagation
17type SegmentTree struct {
18 Array []int // The original array
19 SegmentTree []int // Stores the sum of different ranges
20 LazyTree []int // Stores the values of lazy propagation
21}
22
23// Propagate propagates the lazy updates to the child nodes
24func (s *SegmentTree) Propagate(node int, leftNode int, rightNode int) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected