Method | Description | |
---|---|---|
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 |
Method | Description | |
---|---|---|
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:
|
public AdjustIndexBy ( int index, int valueToAdd, int mod = int.MaxValue ) : void | ||
index | int | |
valueToAdd | int | |
mod | int | |
return | void |
public SumFromTo ( int left, int right, int mod = int.MaxValue ) : int | ||
left | int | |
right | int | |
mod | int | |
return | int |
public static SumTo ( int ft, int right, int mod = int.MaxValue ) : int | ||
ft | int | |
right | int | |
mod | int | |
return | int |
public findAnyIndexWithFreq ( int cumFre ) : int | ||
cumFre | int | |
return | int |
public findLowestIndexWithFreq ( int cumFre ) : int | ||
cumFre | int | |
return | int |