Question: The intersection of two linked lists A and B is a linked list C whose elements are exactly those which are in both A and

The intersection of two linked lists A and B is a linked list C whose elements are
exactly those which are in both A and B.
(a)(10 points) Design an efficient algorithm which takes two ordered linked lists as
input and outputs a new ordered linked list containing the intersection of the
two inputs, and implement it in pseudocode.
(b)(5 points) What is the worst case runtime of your algorithm if the lists have
length m and n respectively? Justify your answer.
(c)(5 points) How would your algorithm and the worst case runtime change if the
initial lists were not guaranteed to be ordered?

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!