bit

package
v0.0.0-...-b071cee Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2023 License: GPL-3.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BinaryIndexedTree

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

Binary Indexed Tree 树状数组

func NewBinaryIndexedTree

func NewBinaryIndexedTree(list []int) *BinaryIndexedTree

NewBinaryIndexedTree 构造一个新的bit

func (*BinaryIndexedTree) PrefixSum

func (b *BinaryIndexedTree) PrefixSum(idx int) int

Prefix return sum of [0:idx]

func (*BinaryIndexedTree) RangeSum

func (b *BinaryIndexedTree) RangeSum(from, to int) int

RangeSum return sum of array[from:to]

func (*BinaryIndexedTree) Update

func (b *BinaryIndexedTree) Update(idx, delta int)

Update add delta to array[idx]

Jump to

Keyboard shortcuts

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