viewing paste Unknown #885 | Text

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
private void doQuickSort() {
        JOptionPane.showMessageDialog (null, "doing quicksort" );
        if(arraydata.getText().equals("")){
            JOptionPane.showMessageDialog (null, "Please insert values to be sorted!" );
        }else
        {
           //Use split method to put the String into String array separated with " " delimeter
           String inputString = arraydata.getText();
           String[] stringParts = inputString.split(" ");
           
           //Convert String array to int array
           int[] ints = new int[stringParts.length];
           for (int i=0; i < stringParts.length; i++) {
               ints[i] = Integer.parseInt(stringParts[i]);
           }
           //System.out.println(ints[2]);
           //Pick a pivot (middle)
           int temp = ints.length/2;
           int pivot = ints[temp];
           //System.out.println("pivot is: "+pivot);
           
           //declaring the low and hi
           int templow = ints[0]; //low
           int temphi = ints[ints.length -1]; //high
           
           while(templow <= temphi){
               while(templow < pivot)
                   templow++;
               while(temphi > pivot)
                   temphi--;
               if(templow <= temphi){
             
               }
           }
        }
        
    }
Viewed 741 times, submitted by Guest.