Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b6vDJ5fWY5uEZaJFNi
18 lines
708 B
Plaintext
18 lines
708 B
Plaintext
Bottom-up merge sort on [38, 27, 43, 3, 9, 82, 10]: one block per pass
|
|
======================================================================
|
|
|
|
pass with width 1:
|
|
[38] + [27] -> [27, 38]
|
|
[43] + [3] -> [3, 43]
|
|
[9] + [82] -> [9, 82]
|
|
array after the pass [27, 38, 3, 43, 9, 82, 10]
|
|
pass with width 2:
|
|
[27, 38] + [3, 43] -> [3, 27, 38, 43]
|
|
[9, 82] + [10] -> [9, 10, 82]
|
|
array after the pass [3, 27, 38, 43, 9, 10, 82]
|
|
pass with width 4:
|
|
[3, 27, 38, 43] + [9, 10, 82] -> [3, 9, 10, 27, 38, 43, 82]
|
|
array after the pass [3, 9, 10, 27, 38, 43, 82]
|
|
|
|
total comparisons: 14
|