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++ <avpostni...@gmail.com> 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 algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to