Skip to content

Latest commit

 

History

History
176 lines (97 loc) · 3.18 KB

segmenttree.md

File metadata and controls

176 lines (97 loc) · 3.18 KB

dastal - v5.0.0 / SegmentTree

Interface: SegmentTree<T>

Type parameters

Name
T

Hierarchy

Implemented by

Table of contents

Properties

Methods

Properties

size

Readonly size: number

The number of elements in the collection.

Inherited from

Collection.size

Defined in

src/collection/collection.ts:5

Methods

[iterator]

[iterator](): Iterator<T, any, undefined>

Returns

Iterator<T, any, undefined>

Inherited from

Collection.[iterator]

Defined in

node_modules/typescript/lib/lib.es2015.iterable.d.ts:51


clear

clear(): void

Removes all elements.

Returns

void

Defined in

src/segmentTree/segmentTree.ts:7


pop

pop(): undefined | T

Retrieves and removes the last element

Returns

undefined | T

The last element or undefined if empty.

Defined in

src/segmentTree/segmentTree.ts:13


push

push(element): number

Appends an element to the tree

Parameters

Name Type Description
element T The element to be inserted

Returns

number

The new size of the tree

Defined in

src/segmentTree/segmentTree.ts:21


query

query(min, max): T

Get the aggregated result of a given range in the tree

Parameters

Name Type Description
min number The start index of the range, inclusive
max number The end index of the range, exclusive

Returns

T

The aggregated result for range [min, max)

Defined in

src/segmentTree/segmentTree.ts:30


update

update(min, max, operation): void

Update the elements of a given range in the tree

Parameters

Name Type Description
min number The start index of the range, inclusive
max number The end index of the range, exclusive
operation (element: T, index: number) => T The update to perform

Returns

void

Defined in

src/segmentTree/segmentTree.ts:38