segment_tree

package
v0.0.0-...-73cdf94 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SegmentTree

type SegmentTree struct {
	// contains filtered or unexported fields
}

func NewSegmentTree

func NewSegmentTree(arr []int, mergeFunc func(int, int) int) *SegmentTree

func (*SegmentTree) Get

func (st *SegmentTree) Get(i int) int

func (*SegmentTree) Len

func (st *SegmentTree) Len() int

func (*SegmentTree) Query

func (st *SegmentTree) Query(queryL, queryR int) int

返回区间[queryL, queryR]的值

func (*SegmentTree) Set

func (st *SegmentTree) Set(index, val int)

在以rootIndex为根的线段树中更新index的值为val

func (*SegmentTree) String

func (st *SegmentTree) String() string

Directories

Path Synopsis
leetcode

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL