Question: Please do in java :) My Code: import java.util.LinkedList; import java.util.List; class Tester { public static List findCommonElements(List listOne, List listTwo){ //Implement your logic here

Please do in java :) Please do in java :) My Code: import java.util.LinkedList; import java.util.List; class

My Code:

import java.util.LinkedList; import java.util.List;

class Tester { public static List findCommonElements(List listOne, List listTwo){ //Implement your logic here and change the return statement accordingly return null; } public static void main(String arga[]){

List listOne = new LinkedList(); listOne.add(10); listOne.add(12); listOne.add(21); listOne.add(1); listOne.add(53); List listTwo = new LinkedList(); listTwo.add(11); listTwo.add(21); listTwo.add(25); listTwo.add(53); listTwo.add(47);

System.out.println(findCommonElements(listOne, listTwo)); } }

Problem Statement Given two linked lists that store integer values, return a linked list containing the common elements from both the lists. Implement the logic inside findCommonElements() method. Test the functionalities using the main() method of the Tester class. Sample Input and Output Sample Input Expected Output listone = 10->12->21->1->53 list Two = 11->21->25->53-> 47 21->53 listone = 51->45->63->15->82 list Two 19-> 63->51->87- >82 51->63->82

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!