You are given two doubly linked lists, L1 and L2, of integers, both sorted in ascending order. You should write a function named setIntersect(L1, L2) that deletes from L1 any element that is not a member of both L1 and L2. In other words, L1 will represent the intersection of L1 and L2 when the function returns. For instance, if you are given the two lists:
L1: (6, 8, 10, 20, 25, 30, 41, 66) L2: (3, 6, 10, 33, 38, 41, 55, 66, 78, 90)then your modified L1 will be:
L1: (6, 10, 41, 66)L2 will remain unchanged. Write the function setIntersect(L1,L2) using my dllist library.
Here is some helpful information:
typedef void Dllist; typedef void Dllist_Node; extern Dllist *new_dllist(); extern void free_dllist(Dllist *l); extern Dllist_Node *dll_prepend(Dllist *l, void *val); extern Dllist_Node *dll_append(Dllist *l, void *val); extern Dllist_Node *dll_insert_before(Dllist_Node *n, void *val); extern Dllist_Node *dll_insert_after(Dllist_Node *n, void *val); extern void dll_delete_node(Dllist_Node *n); extern Dllist_Node *dll_sentinel(Dllist *l); extern Dllist_Node *dll_first(Dllist *l); extern Dllist_Node *dll_last(Dllist *l); extern Dllist_Node *dll_next(Dllist_Node *n); extern Dllist_Node *dll_prev(Dllist_Node *n); extern int dll_empty(Dllist *l); extern void *dll_val(Dllist_Node *n);