merge sorted linked list in c
MergeSorted(Node a,Node b)
if a is NULL and b is NULL
return NULL
if a is NULL
return b
if b is NULL
return a
Node c //Combined List
if((*a).value<(*b).value)
c=a
(*c).next=MergeSorted((*a).next,b)
else
c=b
(*c).next=MergeSorted(a,(*b).next)
return c
Comments
Post a Comment