+ 1

Please help me fix my code

Goal is a simple selection Sort programm, but im having trouble fixing it,i would be happy if someone could help me, Thx in advance. https://code.sololearn.com/cI4u24AamtwG/?ref=app

15th Sep 2018, 2:35 AM
varg
varg - avatar
2 ответов
+ 3
varg why don't you start second loop with j as i considering i elemnt has been sorted.. this will help you to remove lsmall variable.. it is already stored in last i index of array itself.... this will help you to check if condition with two values rather than existing three variables...this seems culprit to me as first look
15th Sep 2018, 8:22 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
+ 1
Thanks sir for your help, i changed (int j=0;(...)) to (int j=i(...) ) and deleted lSmall and now it works :3. Therefore my question got awnsered and i would conclude this discussion as closed. Thx
15th Sep 2018, 9:10 AM
varg
varg - avatar