Given an array of length n where each item has a distance of at most log(n) from its final position in the sorted array, how do I efficiently sort it, and how do I find the k-th valued item (select-k)?
This are my starting ideas:
For sorting, using the comparison model I can get that there are will be approximately O((logn)^n) possible permutations, therefore the max-depth of the comparison tree should be O(nloglogn). Also, for the select problem, I have an intuition that if I look at the range of logn for each side of the k-th item (2logn - 1), I can use a deterministic selection algorithm in O(logn), however I'm not sure about how to prove the correctness of this method.
Please note that I'm not looking for code (in any language), but a sketch of the abstract algorithm and the time complexity for it.
Thanks.