


Given linked list is 1 -> 0 -> 2 -> 1 -> 2.
The sorted list for the given linked list will be 0 -> 1 -> 1 -> 2 -> 2.
The first line contains an integer 'N', the size of the linked list.
The second line contains 'N' space-separated integers containing 0, 1 and 2 only.
The output contains all the integers in non-decreasing order.
You do not need to print anything, it has already been taken care of. Just implement the given function.
The approach would be counting the number of occurrences of 0, 1, and 2. Then updating the data of the linked list in sorted order.
The simple approach would be separating the given linked list into 3 linked lists having 0s, 1s and 2s. Then reconnecting them in sorted fashion.