in complete overlap condition i think it be like this
static int queryTree(int[] a,int[] tree,int Qs,int Qe,int Ss,int Se,int index){
// query for complete Overlap
if (Qs>=Ss && Qe>=Se){
return (tree[Ss]);
}
Query in segment tree
No it should be ( Qs >= Ss and Qe <= Se ), here Qe (query starting ) and Se(segment starting).
Example : 5 elements in the array {1,2,3,4,5}.
Let suppose your query is for {0 , 2}.
So your query will completely lie in left child of root.
( Qs(0) >= Ss(0) and Qe(2) <= Se(2) ) -> return tree[v].
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.