Programming Homework Help

Abbott Academy Find Union and Intersection for Linked List Single Java Coding Task

 

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} and 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.

2. Reverse a singly linked list. Write reverselteratively() method
which reverses a single linked list using a three-pointers approach and using loops. It traverses
through the linked list and adds nodes at the beginning of the singly linked list in each iteration.
It uses three reference variables (pointers) to keep track of previous, current, and next nodes.