C# 클래스 Utils.tree.FenwickTree

파일 보기 프로젝트 열기: eric7237cire/CodeJam

공개 메소드들

메소드 설명
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