Given a sorted circular linked list, the task is to insert a new node in this circular list so that it remains a sorted circular linked list.
First line of input contains number of testcases T. For each testcase first line of input contains length of the linked list, next line contains the linked list elements and the last line contains the element to be inserted into the linked list.
For each testcase, print the new linked list.
The task is to complete the function sortedInsert() which should insert the new node into the given circular linked list.
1 <= T <= 100
0 <= N <= 200
1 2 4
1 4 7 9
1 2 2 4
1 4 5 7 9
Testcase 2: After inserting 5, the linked list would be 1, 4, 5, 7 and 9.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.