posted 8 years ago

hey all, im struggling abit with some psudocode that i have to convert to java. basically im writing a quicksort algorithm which i have been supplied the psudocode for. but im having trouble analysing the psudocode on what part of it.

the bit i am stuck on is it says:

swap(A,pL,pR)

with A being the array of integers i have, and pL and pR being integers of some sort. here is the full psudocode; it is to partition the array before sorting:

the code i have got for it so far is:

does anybody have any idea?

the bit i am stuck on is it says:

swap(A,pL,pR)

with A being the array of integers i have, and pL and pR being integers of some sort. here is the full psudocode; it is to partition the array before sorting:

the code i have got for it so far is:

does anybody have any idea?

~ Jeff Yan ~

Jeff Yan

Ranch Hand

Posts: 42

Campbell Ritchie

Marshal

Posts: 57453

175

posted 8 years ago

Not sure. Try the elements of the array pointed to by the numbers "left" and "right"

Or Google for quicksort and you are bound to find the algorithm explained. I can't remember the details of quicksort. If you do Google you will find (

Or Google for quicksort and you are bound to find the algorithm explained. I can't remember the details of quicksort. If you do Google you will find (

*inter alia*) this, this and this. You will probably understand the first two of those links