Linked List, Easy
Question
Sort a linked list in O(nlogn) time using constant space complexity.
Example 1:
|
|
Example 2:
|
|
Answer
|
|
Using fast and slow pointer to find middle element in LinkedList
t = length/2
slow position = t v = length/2 1 = length/2
Running time: O(nlgn)