Recently I came across a question,
There is an unsorted array of n elements. Once we sort the array,
i th index will have an element. How would you find which element is going to be present on i th index in O(n)
complexity on the unsorted array?
I tried many methods, finally I came to a conclusion that we may need to use an hash map. But later I found that hash map implementation usually follow a tree structure which has an log n
complexity in insertion.
How shall I proceed?