Advertisement
TsetsoP

quicksort_main

Jan 7th, 2021
685
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.72 KB | None | 0 0
  1. package quicksort;
  2. import java.util.Arrays;
  3. import java.util.Scanner;
  4.  
  5.  
  6. public class quicksort_main {
  7.  
  8.     public static void main(String[] args) {
  9.         int N = 0;
  10.         Scanner Input = new Scanner(System.in);
  11.         System.out.println("Input number of elements : ");
  12.         N = Input.nextInt();
  13.        
  14.        
  15.         int[] ARR = new int [N];
  16.         for (int i = 0; i < N; i++){
  17.            
  18.             System.out.printf("Please input the number of element [%d]" ,i);
  19.             ARR[i] = Input.nextInt();
  20.             }
  21.        
  22.         //print before
  23.         System.out.println("Before sorting : " + Arrays.toString(ARR));
  24.        
  25.         //quick sort
  26.         quicksort_methods.QuickSort(ARR,0,N-1);
  27.        
  28.         //print after
  29.         System.out.println("After sorting : " + Arrays.toString(ARR));
  30.        
  31.    
  32.    
  33.  
  34.    
  35.        
  36.     }
  37.  
  38. }
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement