Vanilla Forums has been nominated for a second time in the CMS Critic "Critic's Choice" awards, and we need your vote! Read more here, and then do the thing (please).
Our new Indie Games subforum is now open for business in G&T. Go and check it out, you might land a code for a free game. If you're developing an indie game and want to post about it, follow these directions. If you don't, he'll break your legs! Hahaha! Seriously though.
Our rules have been updated and given their own forum. Go and look at them! They are nice, and there may be new ones that you didn't know about! Hooray for rules! Hooray for The System! Hooray for Conforming!

Java Quicksort Help [Solved]

ZythonZython Registered User regular
edited September 2010 in Help / Advice Forum
Ok, I need to do a quicksort rotuine for my class. I have the following:
Spoiler:

The goal being to find the k-th smallest element in an array.

I also have to do one that's better suited for this purpose, what I have:'
Spoiler:

The problem is that I sometimes get an OutofBoundsIndex Exception at the lines bolded above. Can anyone tell me what I'm doing wrong? If you have any questions, feel free to ask.

Edit: Made problematic lines more visible.

Edit: Found the problem, the for loop wasn't breaking properly, changed to a while loop.

Zython on
3DS Friend Code: 4854-6465-0299 | Wii U: zython
Steam: pazython
Lv 90 Tauren Shaman Lv 90 Pandaren Monk

Posts

Sign In or Register to comment.