Results 1 to 3 of 3
Thread: post increment inside a loop?
- 02-24-2012, 07:42 AM #1
Member
- Join Date
- Nov 2011
- Posts
- 3
- Rep Power
- 0
post increment inside a loop?
So I have the following code I am trying to understand regarding a quicksorting algorithm:
Now my question:Java Code:int end = array.length-1; int start = 0; int endOfList = start; for(int read = start + 1; read<=end; read++) { if(array[read] < pivotValue) { endOfList++; switch(array, read, endOfList); } } switch(array, start, endOfList);
I don't see why we need to call the switch method inside the if...could somebody please explain to me what it does and why it's needed?
Thanks!
- 02-24-2012, 08:54 AM #2
Senior Member
- Join Date
- Nov 2011
- Location
- Turkey
- Posts
- 378
- Blog Entries
- 24
- Rep Power
- 2
Re: post increment inside a loop?
Can you provide the whole code with the main method so I can understand what you are trying to do?
- 02-24-2012, 06:40 PM #3
Member
- Join Date
- Nov 2011
- Posts
- 3
- Rep Power
- 0
Re: post increment inside a loop?
Similar Threads
-
OnClick inside a loop
By sehudson in forum New To JavaReplies: 9Last Post: 05-29-2011, 06:14 AM -
if else inside while loop??
By jonytek in forum New To JavaReplies: 3Last Post: 02-17-2011, 09:28 AM -
Loop inside a switch
By mustachMan in forum New To JavaReplies: 3Last Post: 02-26-2010, 03:25 AM -
quick pre/post increment question
By xtrmi in forum New To JavaReplies: 4Last Post: 02-01-2009, 05:47 PM -
Restart a For loop and increment an Int value
By dcnorman07 in forum New To JavaReplies: 1Last Post: 07-12-2008, 12:24 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks