Leaderboard
Showing:
Handle Score
@Ibrahim Nash 5725
@blackshadows 5685
@akhayrutdinov 5111
@mb1973 4989
@Quandray 4908
@saiujwal13083 4156
@sanjay05 3762
@marius_valentin_dragoi 3511
@sushant_a 3453
@KshamaGupta 3318
@the_coder95 3302
Complete Leaderboard
QuickSort on Doubly Linked List
Hard Accuracy: 69.38% Submissions: 4837 Points: 8

Sort the given doubly linked list using quicksort. Just complete the partition function using quicksort technique try to solve it in O(1) space.

Input:
In this problem, method takes two argument: the node1 and node2. The function should not read any input from stdin/console.
The struct Node has a data part which stores the data and a next pointer which points to the next element of the linked list.
There are multiple test cases. For each test case, this method will be called individually.

Output:
Return p from function.

User Task:
The task is to complete the function 

Constraints:
1 <= T <= 100
1 <= N <= 200

Example:
Input:
2
3
4 2 9
4
1 4 9 2

Output:
2 4 9
1 2 4 9

Explanation:
Testcase 1

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.

QuickSort on Doubly Linked List

Output Window