why i m not getting any result? & is my correct | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

why i m not getting any result? & is my correct

its a quicksort implementation https://code.sololearn.com/cjo0l67HM4h1/?ref=app

5th Jan 2018, 2:34 PM
shobhit
shobhit - avatar
2 Answers
+ 3
https://code.sololearn.com/c5hb6WJk6dNV/?ref=app Here is the corrected version. You are supposed to reset j to the lowest element everytime the sort runs and not just start it with 0. Secondly, you have to swap arr[i] and arr[j] even when the element arr[j] is equal to pivot to get a clear sort. Hope that helps.
5th Jan 2018, 4:37 PM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 1
thnx buddy
5th Jan 2018, 5:08 PM
shobhit
shobhit - avatar