Given an array of integers, we have to answer certain queries where each query has 2 integers. These 2 integers are the 2 indices of the given array and we have to find the median of the numbers present between the 2 indices (inclusive of the given indices.)
Well sorting the array for each query is the most basic solution. Can this be solved with the help of segment trees or range queries?