DAYS
HOUR
MINS
SEC
Error
Sort the given doubly linked list of size N using quicksort. Just complete the partition function using the quicksort technique.
Example 1:
Input:
LinkedList: 4->2->9
Output:
2 4 9
Example 2:
Input:
LinkedList: 1->4->9->2
Output:
1 2 4 9
Your Task:
Your task is to complete the given function partition(), which accepts the first and last node of the given linked list as input parameters and returns the pivot's address.
Expected Time Complexity: O(NlogN)
Expected Auxilliary Space: O(1)
Constraints:
1 <= N <= 200
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?
Yes