Function to update the Binary Index Tree by replacing all ancestors of index by their respective sum with val
static void updateBIT ( int BITree [ ] , int n , int index , int val ) { index = index + 1 ;