Okay So i had this assignment to do: Display two lists of integers generated by
ID: 3652461 • Letter: O
Question
Okay So i had this assignment to do:Display two lists of integers generated by a random number generator, and find and display their intersection and union. And we are supposed to use linked lists. I have this so far:
LinkedList<Integer> Set1 = new LinkedList<Integer>(); //This will be the first list
LinkedList<Integer> Set2 = new LinkedList<Integer>(); //This will the second list
LinkedList<Integer> Set3 = new LinkedList<Integer>(); //This list will show the union
LinkedList<Integer> Set4 = new LinkedList<Integer>(); //This list will show the intersection
Set1.add((int) (15*Math.random())+1);
Set1.add((int) (15*Math.random())+1);
Set1.add((int) (15*Math.random())+1);
Set1.add((int) (15*Math.random())+1);
Set1.add((int) (15*Math.random())+1);
Set1.add((int) (15*Math.random())+1);
Set1.add((int) (15*Math.random())+1);
Set1.add((int) (15*Math.random())+1);
Set1.add((int) (15*Math.random())+1);
Set2.add((int) (15*Math.random())+1);
Set2.add((int) (15*Math.random())+1);
Set2.add((int) (15*Math.random())+1);
Set2.add((int) (15*Math.random())+1);
Set2.add((int) (15*Math.random())+1);
Set2.add((int) (15*Math.random())+1);
Set2.add((int) (15*Math.random())+1);
Set2.add((int) (15*Math.random())+1);
Set2.add((int) (15*Math.random())+1);
So now that i have the first two lists, how will i display the union and the list.
Can someone please help me on this ASAP. Just like explain the union and the intersection code for me. Thank you!