Consider the following problem:
• Input: an array A with n distinct numbers, and an array B withthe same n numbers in a different order.
• Output: the goal is find the number whose position in A ismost similar to its position in B. Formally, say that a pair (i, j)is related if A[i] = B[j]; we want to find the related pair thatminimizes |j − i|. If there multiple pairs that minimize |j − i|,you only have to return one of them.
Write pseudocode for an algorithm that solves this problem inO(n) expected time.
Expert Answer
An answer will be send
PayPal Gateway not configured
PayPal Gateway not configured