Error in Merge sort implementation | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Error in Merge sort implementation

The code give below is code of merge sort. When I run this program I get output array same as input array? I can't trace where is the problem? Can you trace it? https://code.sololearn.com/c2ivmw06r92q/?ref=app

25th Jan 2018, 3:50 PM
kishore kumar
kishore kumar - avatar
1 Answer
+ 2
Your calculation of n gets 1 as 4/4=1. There isn't a way for C to know how many elements are in your array.
25th Jan 2018, 5:07 PM
John Wells
John Wells - avatar