Linked List Intersection

Download Category:

LinkedList_Intersection.zip - (4.83 MB)
[
LinkedList_Intersection/Debug/
LinkedList_Intersection/Debug/cl.command.1.tlog
LinkedList_Intersection/Debug/CL.read.1.tlog
LinkedList_Intersection/Debug/CL.write.1.tlog
LinkedList_Intersection/Debug/Driver.obj
LinkedList_Intersection/Debug/link.command.1.tlog
LinkedList_Intersection/Debug/link.read.1.tlog
LinkedList_Intersection/Debug/link.write.1.tlog
LinkedList_Intersection/Debug/LinkedList_Intersection.exe
LinkedList_Intersection/Debug/LinkedList_Intersection.exe.intermediate.manifest
LinkedList_Intersection/Debug/LinkedList_Intersection.ilk
LinkedList_Intersection/Debug/LinkedList_Intersection.lastbuildstate
LinkedList_Intersection/Debug/LinkedList_Intersection.log
LinkedList_Intersection/Debug/LinkedList_Intersection.pdb
LinkedList_Intersection/Debug/mt.command.1.tlog
LinkedList_Intersection/Debug/mt.read.1.tlog
LinkedList_Intersection/Debug/mt.write.1.tlog
LinkedList_Intersection/Debug/vc100.idb
LinkedList_Intersection/Debug/vc100.pdb
LinkedList_Intersection/Driver.cpp
LinkedList_Intersection/ipch/
LinkedList_Intersection/ipch/linkedlist_intersection-451831b/
LinkedList_Intersection/ipch/linkedlist_intersection-451831b/linkedlist_intersection-3febefd5.ipch
LinkedList_Intersection/linkedlist.h
LinkedList_Intersection/LinkedList_Intersection.sdf
LinkedList_Intersection/LinkedList_Intersection.sln
LinkedList_Intersection/LinkedList_Intersection.suo
LinkedList_Intersection/LinkedList_Intersection.vcxproj
LinkedList_Intersection/LinkedList_Intersection.vcxproj.filters
LinkedList_Intersection/LinkedList_Intersection.vcxproj.user
LinkedList_Intersection/Screenshot.JPG
]

Download the file linkedList.zip and modify the driver.cpp file by implementing the function called listIntersection(). The function will take the intersection of the list1 and list2 parameters and will place the results in a third parameter called results. The prototype for this function is as follows:

template

void listIntersection(linkedListType& results,

linkedListType& list1,

linkedListType& list2);

The results of the intersection between two lists (e.g. list1 and list2) will consist of all of the elements in list1 that are also in list2, but no other elements. For example, given list1 = {10, 20, 12, 12, 13, 14} and list2 = {14, 12, 10, 30, 31, 31}, then the intersection between list1 and list2 would be results = {10, 12, 14}. Duplicate elements should not appear in the results list.

Hint: You only need to modify the areas of the code in the driver.cpp file that are marked with the TODO comments. Everything else should remain that same. You can implement this function anyway you like, but you must use the provided lists and function prototype. The printList() function provides an example on how to use a for-loop with an iterator for a passed in list parameter.

Output: The output for the program after the function is implemented should appear as follows:

List 1:

21 41 86 34 71 89 11 34 76 76

List 2:

76 41 8 64 11 89 31 24 86 86

List 1 intersected with List 2:

41 86 89 11 76

** Press any key to continue **

Write a Review

Get a fresh solution of this question. Ask it now to our experts.
doubt

Ask Your Question

We have verified professionals who are ready to answer your question.

time

Save Time and Money

We choose experts who can quickly answer your question and that suit your budget.

download

Get Your Answer

Your satisfaction is 100% guaranteed. You can keep on asking questions until you get the answer you need.