Documentation
¶
Index ¶
- type SegmentTree
- func (s *SegmentTree) Build(node int, left int, right int)
- func (s *SegmentTree) Propagate(node int, leftNode int, rightNode int)
- func (s *SegmentTree) Query(node int, leftNode int, rightNode int, firstIndex int, lastIndex int) int
- func (s *SegmentTree) Update(node int, leftNode int, rightNode int, firstIndex int, lastIndex int, ...)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SegmentTree ¶
SegmentTree with original Array and the Segment Tree Array
func NewSegmentTree ¶
func NewSegmentTree(Array []int) *SegmentTree
func (*SegmentTree) Build ¶
func (s *SegmentTree) Build(node int, left int, right int)
Build Segment Tree node, leftNode and rightNode always should start with 1, 0 and len(Array)-1
func (*SegmentTree) Propagate ¶
func (s *SegmentTree) Propagate(node int, leftNode int, rightNode int)
Propagate lazy tree node values
func (*SegmentTree) Query ¶
func (s *SegmentTree) Query(node int, leftNode int, rightNode int, firstIndex int, lastIndex int) int
Query on interval [firstIndex, leftIndex] node, leftNode and rightNode always should start with 1, 0 and len(Array)-1
func (*SegmentTree) Update ¶
func (s *SegmentTree) Update(node int, leftNode int, rightNode int, firstIndex int, lastIndex int, value int)
Update Segment Tree node, leftNode and rightNode always should start with 1, 0 and len(Array)-1 index is the Array index that you want to update value is the value that you want to override
Click to show internal directories.
Click to hide internal directories.