Advertisement
Ivan18113

Алгоритми - Тема 14 (QuickSortMain)

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