Input are a sequence S of n distinct keys, not necessarily in sorted order, and two integers m1 and m2(1 ≤ m1, m2 ≤n) . For any x in S, we define the rank of x in S to be
|{k∈S :k ≤x}|. Write an algorithm that will output all the keys of S whose ranks fall in the interval [m1, m2]