New here. So, I was able to figure how to iterate through each element in A and compare it to one element in B. If the elements do not match, then store the element into another list, and recursively call the function to the next node in list A. The obvious problem with this is that it will compare all elements in A to only the first element in B. But I'm having difficulties on how to access the next element or node in B recursively to return a new set containing values in set A that are not in set B.
Yes, the lists are sorted.
Node *diff(Node *a, Node *b) {
Node *tmp;
tmp = malloc(sizeof(Node));
if ( (a == NULL) || (b == NULL) ) //Base case
return NULL;
if (a->val != b->val){
tmp = a;
tmp->next = sset_diff(a->next, b);
}
return tmp;
return NULL; //Placeholder
}