Question: Let A = { x 1 , x 2 , . . . , xn } and B = { y 1 , y 2
Let A x x xn and B y y yn be two lists, each with n unique integer elements. Consider the problem of finding their intersection ie elements they have in common.
a Give in details a bruteforce algorithm for solving this problem and determine its efficiency. May either describe or give pseudo code.
b What if the two list are sorted? Suggest an algorithm with most improved time complexity to find the intersection of the two list. Give the efficiency of your the algorithm.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
