kaist-cp/cs500

Odd-even Merge Sort when n=1

Closed this issue · 1 comments

(For the future readers, I'm looking at commit 6285bfa)
When n=1, in the Algorithm 3.2 Odd-Even Merge Sort, it is not clear how the function call works.
Line 4, 5 should be ignored because the lengths of the arguments are less than 2.
Then the resulting sequence (line 8) is not correct. A counterexample is shown below.

A=(2,5), B=(1,6)   (n=1)
Line 8 yields (2, 1, 5, 6)

Could someone help me out?

Issue #62 solves your problem, although this ruins the even length assumption.