Question: 1. Find Union and Intersection of two sets. Given two sets (elements in a set are distinct), write a method that finds the union and

1. Find Union and Intersection of two sets. Given two sets (elements in a set are distinct), write a method that finds the union and intersection of two sets using linked list. E.g., given A= {6,1,3, 20,7 }, B={2,6,8,3,5} your algorithm should print Union as {1, 2, 3, 5, 6, 7, 8, 20} and Intersection as {3, 6}. Note that the elements of union and intersection can be printed in any order. (java code)

2. Write a method rotate(list,k) which rotates an integer list by a given number k. k elements from the end should move to the beginning of the list, and all other elements should move to right to make the space. E.g., if list a is initialized with elements l = {1, 2, 3, 4, 5, 6, 7, 8, 9}. (java code)

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!