where st - . Pointer to segment tree index - . Index of current node in the segment tree . Initially 0 is passed as root is always at index 0 ss & se - . Starting and ending indexes of the segment represented by current node i . e . st [ index ] qs & qe - . Starting and ending indexes of query range
static int queryUtil ( int [ ] st , int ss , int se , int qs , int qe , int index ) {