fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. static void quickSort(int[] x,int l,int r){
  11. if(l<r){
  12. int pivIdx=l;
  13. int pivVal=x[l];
  14. x[pivIdx]=x[r];
  15. x[r]=pivVal;
  16. int i=l-1;
  17. int j=r;
  18. do{
  19. do{i++;}while (x[i]<pivVal);
  20. do{j--;
  21. if(j<0){
  22. break;
  23. }
  24. }while (x[j]>pivVal);
  25. if(i<j){
  26. int temp =x[i];
  27. x[i]=x[j];
  28. x[j]=temp;
  29. }
  30. }while (i<j);
  31. x[r]=x[i];
  32. x[i]=pivVal;
  33. quickSort(x,l,i-1);
  34. quickSort(x,i+1,r);
  35. }
  36. }
  37. public static void main (String[] args) throws java.lang.Exception
  38. {
  39. // your code goes here
  40. }
  41. }
Success #stdin #stdout 0.09s 54596KB
stdin
Standard input is empty
stdout
Standard output is empty