the following function gets as an argument two sorted linked lists
which are sorted by value in ascending order.
there may be nodes with equal value variable in them.
the function merges both functions into a new one.
in which every node has a unique value (in the value variable)(we cut the copies)
you are not alloed to use malloc
but you need to delete twin nodes (with the sme number in the value variable)
fill the missing gaps
Code:
#define BIG 999999999
typedef struct item item;
struct item {
int value;
item *next;
};
item *different_merge(item *l1,item *l2){
item *temp;
int v1,v2;
if(!l1 && !l2) return NULL;
if(l2 && l2->next && l2->value==l2->next->value){
temp= ?? 1 ?? ;
?? 2 ??;
return ?? 3 ??;
}
if(l1 && l1->next && l1->value==l1->next->value){
temp=?? 4 ??;
?? 5 ??;
return ?? 6 ??;
}
v1=(l1) ? l1->value:BIG;
v2=(l2) ? l2->value:BIG;
if(v1==v2){
temp=?? 7 ??;
?? 8 ??;
return ?? 9 ??;
}
if(v1<v2){
?? 10 ?? =?? 11 ??;
return ?? 12 ??;
}
?? 13 ??= ?? 14 ??;
return ?? 15 ??;
}