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 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 points What is the worst case runtime of your algorithm if the lists have
length m and n respectively? Justify your answer.
c 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
