Problem of the day
The first line of input contains a single integer T, representing the number of test cases or queries to be run.
Then the T test cases follow.
The first line of each test case contains the elements of the singly linked list separated by a single space and terminated by -1. Hence, -1 would never be a list element.
For each test case, print the sorted linked list. The elements of the sorted list should be single-space separated, terminated by -1.
The output of each test case is printed in a separate line.
You are not required to print the output, it has already been taken care of. Just implement the function.
1 <= T <= 10
1 <= N <= 10^4
-10^9 <= data <= 10^9 and data != -1
Where data is the value associated with the node.
Time Limit: 1 sec
3
1 -2 3 -1
9 9 -1
4 -1
-2 1 3 -1
9 9 -1
4 -1
For every test case, the sorted list is printed, terminated by -1.
2
1 1 1 -1
3 -3 -1
1 1 1 -1
-3 3 -1