
import java.util.*;
import java.awt.*;
import java.lang.Math.*;
import java.lang.*;

public class Quantile{
        public static void main (String arg[]){
                
                int[] a = new int[5000];
                int count = 0;
                
                Random rand = new Random(System.currentTimeMillis());
                for (int i = 0; i < 5000; i++){
                        int x = java.lang.Math.abs((rand.nextInt() %
5000)) ;
                        a[i] = x;
                                        
                        
                }
        
                for (int j = 0; j < 5000; j++){
                        int key = a[j];
                        int z = j - 1;
                        while ((z > 0) && (a[z] > key)){
                                a[z+1] = a[z];
                                z = z - 1;
                                a[z+1] = key;
                                count++;
                        }
                }
                
                //for (int n = 0; n < 5000; n++){
                //      System.out.println(a[n]);
                //}
                                // THIS OPTIONALLY PRODUCES THE LIST
                
                System.out.println("Producing Quantiles...");
                
                int y = 0;
                int s = 5;      // VARIBLE "s" PRODUCES k - 1 QUANTILES
                int k = 5000/s;                 
                                // THIS IS THE "k" THAT CONTROLS THE
QUANTILES
                
                System.out.println("Calculating " + s + "th
Quantiles...");
                for (y = k; y < 5000; y+=k){
                        System.out.println(a[y]);
                }
                System.out.println("Quantile Production Complete...");
                System.out.println("Number of Comparisons = " + count + 
                                        ". Not prizewinning by any
means!");
        }
}


