Quicksort In Linkedlist

easy
1. Given the head of a linked list, return the list after sorting it in increasing order.
2. You must apply quick sort.
3. Time Complexity : O(nlogn)
4. Space Complexity : constant space 

Input Format

1->7->2->6->3->5->4->null

Output Format

1->2->3->4->5->6->7->null

Constraints

0 <= N <= 10^6

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

Input
4
0
6
7
5
Output
0 5 6 7 
Previous
Segregate 012 Node Of Linkedlist By Swapping Data
Next
Segregate Node Of Linkedlist Over Last Index.

Related Questions