Runz W Scissorz

03-14-2005, 07:02 PM

hey im sorry if this isnt the appropriate place for this, but i dont know too many other reliable boards to ask on

i was wondering how the heck a quicksort is implemented with a randomly selected pivot. is this possible? im trying to implement one and I cant for the life of me get a correctly sorted list (keeping my left and right indexes from going out of bounds of the array was a challenge enough). im sure it is possible, ive just never seen it implemented, nor do i know why anyone would.

basically, id have an array of N integers, and id run

(private void) quicksortRandomPivot(int[] a, 0, N-1){

}

on them, where a is the array, 0 is the first or left index, and N-1 is the last or right index.

thanks if anyone knows how to implement one.

i was wondering how the heck a quicksort is implemented with a randomly selected pivot. is this possible? im trying to implement one and I cant for the life of me get a correctly sorted list (keeping my left and right indexes from going out of bounds of the array was a challenge enough). im sure it is possible, ive just never seen it implemented, nor do i know why anyone would.

basically, id have an array of N integers, and id run

(private void) quicksortRandomPivot(int[] a, 0, N-1){

}

on them, where a is the array, 0 is the first or left index, and N-1 is the last or right index.

thanks if anyone knows how to implement one.