Discover Packages
github.com/modern-dev/gtl
containers
bit
package
Version:
v0.2.12
Opens a new window with list of versions in this module.
Published: Oct 30, 2021
License: MIT
Opens a new window with license information.
Imports: 0
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
Documentation
¶
NewBIT returns an object representing Binary Index Tree or Fenwick Tree of given size.
Len returns the size of the BIT.
Complexity - O(1).
Query returns a sum of first [0...index] elements of Binary Index Tree.
Complexity - O(LogN).
func (this *BIT ) Update(index, val int )
Update updates a node in Binary Index Tree (BIT) at given index in BIT.
The given value `val` is added to BIT[i] and all of its ancestors in tree.
Complexity - O(LogN).
Source Files
¶
Click to show internal directories.
Click to hide internal directories.