Given Tree
Node * root = newNode ( 1 ) ; root -> left = newNode ( 3 ) ; root -> left -> left = newNode ( 5 ) ; root -> left -> right = newNode ( 6 ) ; root -> right = newNode ( 2 ) ; root -> right -> right = newNode ( 4 ) ; root -> right -> right -> left = newNode ( 7 ) ; root -> right -> right -> right = newNode ( 0 ) ; int wt [ ] = { 8 , 6 , 4 , 5 , 1 , 2 , 9 , 1 } ; vector < vector < int > > queries { { -1 , 1 } , { -2 , -1 } , { 0 , 3 } } ; solveQueries ( wt , root , queries ) ; return 0 ; }