This is a simple web app to find the union and intersection of two linked lists. The app is built using HTML, CSS and JavaScript. The app is hosted on Github.
The algorithm used to find the union and intersection of two linked lists is as follows:
- Create a new linked list. Let the new linked list be
unionList
. - Insert all the elements of the first linked list in
unionList
. - Traverse the second linked list. For every element being traversed, check if it is present in
unionList
. If the element is not present, then insert it at the end ofunionList
. unionList
contains the union of the two linked lists.
- Create a new linked list. Let the new linked list be
intersectionList
. - Traverse the first linked list. For every element being traversed, check if it is present in the second linked list. If the element is present in the second linked list, then insert it at the end of
intersectionList
. intersectionList
contains the intersection of the two linked lists.