Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b6vDJ5fWY5uEZaJFNi
12 lines
395 B
Plaintext
12 lines
395 B
Plaintext
Merge sort on a singly linked list
|
|
==================================
|
|
|
|
before 38 -> 27 -> 43 -> 3 -> 9 -> 82 -> 10 -> null
|
|
after 3 -> 9 -> 10 -> 27 -> 38 -> 43 -> 82 -> null
|
|
same 7 node objects, relinked: true
|
|
|
|
1,000,000 random values: top-down and bottom-up both match Arrays.sort
|
|
|
|
split written with fast = head (instead of head.next), input 2 -> 1 -> null:
|
|
java.lang.StackOverflowError
|