C# Класс Utils.tree.FenwickTree

Показать файл Открыть проект

Открытые методы

Метод Описание
AdjustIndexBy ( int index, int valueToAdd, int mod = int.MaxValue ) : void
FenwickTree ( int n ) : System
SumFromTo ( int left, int right, int mod = int.MaxValue ) : int
SumTo ( int ft, int right, int mod = int.MaxValue ) : int

Returns cumulative sum from [1, right]

findAnyIndexWithFreq ( int cumFre ) : int
findLowestIndexWithFreq ( int cumFre ) : int

Приватные методы

Метод Описание
SubtractLeastSignificantBit ( int S ) : int
msb32 ( int x ) : int

Given a binary integer value x, the most significant 1 bit (highest numbered element of a bit set) can be computed using a SWAR algorithm that recursively "folds" the upper bits into the lower bits. This process yields a bit vector with the same most significant 1 as x, but all 1's below it. Bitwise AND of the original value with the complement of the "folded" value shifted down by one yields the most significant bit. For a 32-bit value:

Описание методов

AdjustIndexBy() публичный Метод

public AdjustIndexBy ( int index, int valueToAdd, int mod = int.MaxValue ) : void
index int
valueToAdd int
mod int
Результат void

FenwickTree() публичный Метод

public FenwickTree ( int n ) : System
n int
Результат System

SumFromTo() публичный Метод

public SumFromTo ( int left, int right, int mod = int.MaxValue ) : int
left int
right int
mod int
Результат int

SumTo() публичный статический Метод

Returns cumulative sum from [1, right]
public static SumTo ( int ft, int right, int mod = int.MaxValue ) : int
ft int
right int
mod int
Результат int

findAnyIndexWithFreq() публичный Метод

public findAnyIndexWithFreq ( int cumFre ) : int
cumFre int
Результат int

findLowestIndexWithFreq() публичный Метод

public findLowestIndexWithFreq ( int cumFre ) : int
cumFre int
Результат int