Return the frequency of the character in the i - th prefix .
int getFrequency ( int tree [ max ] [ 27 ] , int idx , int i ) { int sum = 0 ; while ( idx > 0 ) { sum += tree [ idx ] [ i ] ; idx -= ( idx & - idx ) ; } return sum ; }