Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You are given two sequences, (a_1, a_2, ..., a_n) and (b_1, b_2, ..., b_n), wher

ID: 3922009 • Letter: Y

Question

You are given two sequences, (a_1, a_2, ..., a_n) and (b_1, b_2, ..., b_n), where each sequence consists of distinct integers. Describe a linear time algorithm (in the average case) that tests if a sequence is a permutation of the other. Assume that the simple uniform hashing assumption holds. Explain the running time of your algorithm. "You are given two sequences, and , where each sequence consists of distinct integers. Describe a linear time algorithm (in the average case) that tests if a sequence is a permutation of the other. Assume that the simple uniform hashing assumption holds. Explain the running time of your algorithm."

Explanation / Answer

Explanation of the running time : We are coutinng how many times each element appearing in each list followed by each element appears exactly the same times in each sequence.