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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started