Given a sorted singly linked list and a data, your task is to complete the function sortedInsert() that inserts the data in the linked list in sorted way i.e. order of the list doesn't changes.
The function takes 2 arguments as input, reference pointer to the head of the sorted single linked list and an integer data value which is to be inserted in the list.
There are multiple test cases and for each test case the function will be called separately.
For each test output will be space separated integers denoting the values of the linked list.
The task is to complete the function sortedInsert() which should insert the element in sorted Linked List.
1 <= T <= 100
0 <= N <= 100
-999 <= A <= 999
25 36 47 58 69 80
19 25 36 47 58 69 80
50 75 100
Testcase 1: After inserting 19 at particular place, the linked list is like 19, 25, 36, 47, 58, 69, 80.
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.