Question: 2 . Let A and B be two sequences of n integers each. Give a pseudo - code of an O ( n log n

2. Let A and B be two sequences of n integers each. Give a pseudo-code of an O(n log n) algorithm for printing all integers that A and B have in common. For instance, if A is 2,7,4,9,10,5, and B is 20,5,3,6,8,7, then the algorithm should output 7 and 5.(The order in which the numbers are printed is not important). If a number appears more than once in A and B, then it should be printed as many times as there are common occurrences of it. For instance, if A is 1,0,1,1 and B is 2,1,1,3, then the algorithm should output 1 two times. Explain why the running time of your algorithm is O(n log n).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!