for each element i in A[n] do
        map (A[n],i)

for each element j in B[n] do
        index = B[n]
        X[index] = map.get(index);

This will traverse both the array once, so O(n+n) = O(n) time.

On Dec 31, 1:44 pm, juver++ <[email protected]> wrote:
> of course, we should keep pair - element and its initial position

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to