I am practicing some algorithm problems before an exam in a C language course and and I got stuck (for at least 3 or even 4 hours) at this question which I don't know how to answer:
You have two circular singly linked lists that are already sorted, you have to merge them and return the head of the new circular linked list without creating any new extra nodes. The returned list should be sorted as well.
The node structure is:
typedef struct Node {
int data;
struct Node* next;
} Node;
I tried many ways (recursive and non recursive) but none solved the problem.
Thanks for any help.
1->1->1->1->...->1is a valid sorted linked list). You need to mark the head and end the merge when reaching it. - amit