Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4
The error message is: maximum recursion depth exeeded in comparison.
18th Aug 2019, 10:58 AM
Lothar
Lothar - avatar
+ 4
Here is s python tutorial about qsort: https://www.sololearn.com/learn/708/
18th Aug 2019, 11:18 AM
Lothar
Lothar - avatar
+ 3
You should first have la ook on your code and the logic it follows. But sometimes it’s difficult to figure out the problems. so i suggest you to go through the code with a debugger so that you can see how variale content is changing. in your code the problem occurs also if you just pass 2 values. If degugging is not possible you can add temporararely some print functions with variables to see what happens.
18th Aug 2019, 11:08 AM
Lothar
Lothar - avatar
+ 2
Your calling the qsort in the return statement but you haven't implemented a condition to exit the recursion. what are you trying to do? what input are you expecting? what output are you expecting? Try "return right + left" instead of "return qsort(right) + qsort(left)"
18th Aug 2019, 11:55 AM
rodwynnejones
rodwynnejones - avatar