I'm not getting sorted array ????? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I'm not getting sorted array ?????

i use merge sort algo to sort my array but there is something wrong which i have written pls help me to find out 😐 Check my attempt here 👇 https://code.sololearn.com/c7uz9habOz21/?ref=app

22nd Aug 2022, 5:48 AM
Davinder Kumar
Davinder Kumar - avatar
2 Answers
+ 1
Jayakrishna🇮🇳 it took me long time to find a problem in this code. finally resolved it. Thanks you
22nd Aug 2022, 12:08 PM
Davinder Kumar
Davinder Kumar - avatar
0
In the first for loop of mergesort() method, use array "a", not b. And in merge() method, use index as k => c[k] for all "c" Array instances...
22nd Aug 2022, 10:49 AM
Jayakrishna 🇮🇳