Struct Node{
int data;
struct node* p;
}
we are assuming that both the given list are sorted.
node mergeSort(node a, node b){
if(a == null) return b;
if(b == null) return a;
if(a.value <= b.value){
a.next = mergeSort(a.next, b);
retrun a;
}else{
b.next = mregeSort(a, b.next);
return b;
}
}
No comments:
Post a Comment