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.
25 36 47 58 69 80
19 25 36 47 58 69 80
50 75 100
Note:The Input/Ouput format and Example given are used for system's internal purpose, and should be used by a user for Expected Output only. As it is a function problem, hence a user should not read any input from stdin/console. The task is to complete the function specified, and not to write the full code.
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.