Why are you using tail recursion when an iterative approach would be
more efficient?
Don

On Feb 23, 3:41 am, rahul sharma <rahul23111...@gmail.com> wrote:
> struct node* SortedMerge(struct node* a, struct node* b)
> {
>   struct node* result = NULL;
>
>   /* Base cases */
>   if (a == NULL)
>      return(b);
>   else if (b==NULL)
>      return(a);
>
>   /* Pick either a or b, and recur */
>   if (a->data <= b->data)
>   {
>      result = a;
>      result->next = SortedMerge(a->next, b);
>   }
>   else
>   {
>      result = b;
>      result->next = SortedMerge(a, b->next);
>   }
>   return(result);
>
> }
>
> a : 10 20 30
>
> b : 10 25  35
> wats the o/p??? 10 20 25 30 35
> or 10 10 20 25 30????

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to