Question: Please answer quickly! I will upvote. Thank you. This is an exercise in Java. Write a static method to be added to the SLinkedList class
Please answer quickly! I will upvote. Thank you.
This is an exercise in Java.
Write a static method to be added to the SLinkedList class you have seen in the pre-recorded lectures. The method is called get_intersection() and it takes two singly linked list as input. The method returns a singly linked list representing the intersection of the two input lists. If the two input lists do not intersect, then the method returns an empty list. Note that we say that two lists intersect when they have at least one node in common. The intersection is defined base on reference, not on value! The node needs to be exactly the same node, and not only contain the same value. This method should run in O(max(n, m)) where n and m represents the number of elements of the input lists.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
