[solved] Not able to find issue in merge sort | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

[solved] Not able to find issue in merge sort

Hi I tried checking with printing values on my merge sort implementation as below: Could not find what issue it has. Can anyone pin point issue ? I feel that when 9 and 3 is passed as merge function, it does not swap but I am missing what issue is. Sorry for this question but I could not get answer by debugging almost for 1 hour. https://code.sololearn.com/chjg0iDszBk4/?ref=app

6th May 2021, 2:33 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
2 Answers
+ 2
A very little mistake in merge function you should initialize k with l k=l; Cause we are running merger from l to r so it should be start from l
6th May 2021, 2:45 PM
YUGRAJ
0
Thank you so much
6th May 2021, 2:46 PM
Ketan Lalcheta
Ketan Lalcheta - avatar