Range Minimum Query above a constant value

55 Views Asked by At

Given an array of n elements . Find minimum value of element in range [l...r] such that a[k]> p . ( l<=k<=r and p varies with each l and r).

Is there any solution that works in log(N)?

1

There are 1 best solutions below

0
On

PS : I thought of a solution to find(k) number of elements that are less than <= p. And then find the k+1th element in range if the array is sorted.but I am stuck at point update operation for the persistent segment tree for finding the k+1 th element.