I have an unsorted array. I have queries in which I give a range and then the maximum value from that range has to returned. For example:array[]={23,17,9,45,78,2,4,6,90,1};query(both inclusive): 2 6answer: 78Which algorithm or data structure do I construct to quickly retrieve maximum value from any range. (There are a lot of queries)EDIT:This is indeed a simple version of the actual problem. I can have the array size as large as 100000 and the number of queries upto 100000. So I definitely require some preprocessing which'll facilitate a fast query response.
Retrieving maximum value from a range in unsorted array
algorithms;array