Welcome to the forums! Whether or not this is hw, I encourage you to take a little more time to bug test. Problem solving in general is a really valuable skill.
Specifically, seeing that you have two functions, merge()
, and mergesort()
, try testing each function individually. Another good idea is to start with really small test-cases that you can trace by hand.
Hope this helps!