Medium Accuracy: 56.64%
Submissions: 3865 Points: 4
Given an array A[ ] and its size N your task is to complete two functions a constructST function which builds the segment tree and a function RMQ which finds range minimum query in a segment tree .
The task is to complete two functions constructST and RMQ .
The constructST function builds the segment tree and takes two arguments the array A[ ] and the size of the array N .
It returns a pointer to the first element of the segment tree array .
The RMQ function takes 4 arguments the first being the segment tree st constructed, second being the size N and then third and forth arguments are the range of query a and b .The function RMQ returns the min of the elements in the array from index range a and b. There are multiple test cases. For each test case, this method will be called individually.
The function RMQ should return the min element in the array from range a to b .
1<=Q(no of queries)<=10000
Input (To be used only for expected output)
1 2 3 4
0 2 2 3
1. For query 1 ie 0 2 the element in this range are 1 2 3 and the min element is 1 2. For query 2 ie 2 3 the element in this range are 3 4 and the min element is 3