Question: 1. Linked Lists Difference (25 pts) uppose you are given two sorted lists of integers. The difference of the first list with respecs to the

 1. Linked Lists Difference (25 pts) uppose you are given two

1. Linked Lists Difference (25 pts) uppose you are given two sorted lists of integers. The difference of the first list with respecs to the second is the set of all entries that are in the first list but not in the second, in the se order as in the original first list. For example 12: 2-3-36->12->19 Difference L1-L2: 9-15->21 Implement a NON-RECURSIVE method to compute the difference and return it in a N list. The original linked lists should not be modified. The new linked list sho EW linked uld have a complete neither of the new set of Node objects (not shared with the original lists). You may assume that original lists has any duplicate items. Your implementation MUST use the efficient algorithm covered in Problem Set 2 on a sim ilar per list to track simultaneously. you use some other inefficient algorithm, you will get AT MOST HALF the credit. You may implement helper methods if needed public class Node t public int data; public Node next; public Node(int data, Node next) ( this.data data; this.next next // Creates a neu linked list consisting of the items that are in the first // list but not in the second, // Returns the front of this nev linked list public static Node difference (Node frontL1, Node frontL2) ( in the same order as in the first list // COMPLETE THIS METHOD YOU MAY *NOT USE RECURSION

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 Databases Questions!