#Exception thread can't figure out why

31 messages · Page 1 of 1 (latest)

night elm
#

Trying to make a quicksort and partition method, the quicksort method keeps throwing me an Index out of bounds exception error despite me following the guide completely.

Screenshot of code

magic etherBOT
#

This post has been reserved for your question.

Hey @night elm! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

night elm
#

screenshot of error

#

I think the error is how I am calling it as the error disappears when I do not call it

versed eagle
#

You're double incrementing the i variable in the partition for loop. That could be an issue

stray hill
#

It would be better if you didn't screenshot your code

#

And actually posted it here in a format

#

So people could test it and see if they need to

night elm
#

Hey, I didn't get the notification so my bad for the late response.

river swift
night elm
#

Oof

#

Calling with 1 does not properly sort it, can you explain what I need to change to get it to sort properly?

river swift
night elm
#

Thank you

magic etherBOT
# night elm Thank you

If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.

river swift
night elm
#

I'll try that article out and come back if I have any bugs that I can't fix

river swift
#

sure

#

you need to fix in your code only 1 letter. But you need to find it

night elm
#

I genuinely can't find, is it around the calling of the method or in the declaration?

river swift
#

you need j++ instead of i++

night elm
#

OHHHHHH

#

ITS WORKING

#

Why do "j" and "i" look so similar 😭

#

Thank you

magic etherBOT
# night elm Thank you

If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.

night elm
#

I will close now

river swift