Question: Problem 1: (35 points) a) Given two sorted lists, L1 and L2, complete a following procedure in Java to compute: L1 L2 = {

 Problem 1: (35 points) a) Given two sorted lists, L1 and

Problem 1: (35 points) a) Given two sorted lists, L1 and L2, complete a following procedure in Java to compute: L1 \ L2 = { x 1 x E L1 and x L2 } using only the basic list operators (next(), hasNext(), and compareTo)) and one loop public static > void difference(List L1, List Difference) ListteratorAnyType> iterL1 . L1.1ist Iterator(); Listterator iterL2- L2.1istiterator(); if (iterl1.hasNext() 8& iterL2. hasNext(O itemL1 itemL2 iterL1.next(); iterL2.next); /I YOUR CODE GOES HERE b) Write a method in Java to sort a stack of n integer numbers, s, in descending order static Stack sort(Stack s) To implement this method you must use one more auxiliary stack and you should not make any assumptions about how the stack is implemented. The following are the only functions that should be used to write this program: push, pop, peek, and isEmpty. What is the running time complexity of your method? Justify Important Notes: For this problem, you only need to submit the implementation of two methods in Java (difference and sort) . In the case of your sort method don't forget to indicate (and justify) the running time complexity of your solution

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!