Advertisement
Vankata17

QuickSortMain

Jan 15th, 2021
780
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.80 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.util.Arrays;
  4. import java.util.Scanner;
  5.  
  6. import static com.company.QuickSortMethods.QuickSort;
  7.  
  8.  
  9. public class QuickSortMain {
  10.         public static void main(String[] args) {
  11.             Scanner scan = new Scanner(System.in);
  12.             System.out.print("Input the number of elements /N/ : ");
  13.  
  14.             int N = Integer.parseInt(scan.nextLine());
  15.             int[] ARR = new int[N];
  16.             for (int i = 0; i <N ; i++) {
  17.                 System.out.printf("Input [%d] element of the array: ",i);
  18.                 ARR[i] = Integer.parseInt(scan.nextLine());
  19.             }
  20.             System.out.println("Before: " + Arrays.toString(ARR));
  21.             QuickSort(ARR,0,N-1);
  22.             System.out.println("After: "+ Arrays.toString(ARR));
  23.         }
  24.     }
  25.  
  26.  
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement