Merge Sort Linked List
4231
42 31
4 2 3 1
--------------------------------------------------------------------
24 13
1234 public ListNode split(ListNode head){
if (head == null) return head;
ListNode slow = head;
ListNode fast = head;
while(fast.next != null && fast.next.next != null){
slow = slow.next;
fast = fast.next.next;
}
return slow;
}Last updated