Sort List
Sort a linked list in O(n log n) time and O(1) memory space using merge sort.
Sort List

Sort a linked list in O(n log n) time and O(1) memory space using merge sort.

Example 1:
Input: {"head":[4,2,1,3]}
Output: [1,2,3,4]
Input
arr ={"head":[4,2,1,3]}

Phase: Finding Middle (Slow/Fast Pointers)

Starting merge sort on linked list

head

4

2

1

3

NULL
head: 4
Variables
No variables to display
DepthFunction Call
Stack empty
0/12