INTRODUCTION:
The objective of the 'Intersection of two list' is to find the common elements in two lists taken into consideration. It is to be noted that this code works fine for only SORTED LISTS. Incase if unsorted lists are taken into consideration, we need to call the sort() function inorder to sort the lists and then find the common elements in the lists.
In the source code, 'temp1' and 'temp2' are pointers that are used to traverse the list L1 and L2 respectively. These two temporary variables point to the first element of the lists initially.
Initially first element of the List L1 is compared with the first element of the List L2. If the former is smaller, only List L1 is traversed , or if the latter is smaller , only List L2 is traversed. If there is any element in common, then that element is inserted into another new list called 'm' and in this case both the lists are traversed together . It is to be noted that in any of the above cases , the lists can be traversed using 'while' loop only if temp1 and temp2 don't point to NULL.



Labs
