Results 1 to 2 of 2

Thread: java quicksort question

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2004

    java quicksort question

    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.

  2. #2
    Senior Member Regular Contributor
    Join Date
    Aug 2003

    Re: java quicksort question

    You could try a book. Sedgewick's Algorithms in C++ is a classic I think. Then you'd only need to translate the code to java. That shouldn't be so hard.

Similar Threads

  1. Replies: 5
    Last Post: 05-02-2011, 10:26 AM
  2. java
    By bigrockcrasher in forum OpenGL: User Software
    Replies: 1
    Last Post: 03-05-2006, 08:21 AM
  3. Java
    By in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 08-14-2004, 12:44 PM
  4. Java
    By JanHH in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 08-15-2003, 04:36 AM
  5. Java vs C#
    By Music_Man in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 12-03-2002, 11:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean