I am learning about Segment tree topic.
Let’s say you are given an array ar
whose size is n
and you build a segment tree for range minimum query. The segment tree size would be less than 4n
.
for eg:
given array : 1 23 4 51 6 7 with size of n=6
in the given array, element 51
is present at position 4
(1-based indexing).
Now after building segment tree (which is stored in array of 1-based indexing), how can I get the index of element 51
from the segment tree? At what index would it be stored in the segment tree?