Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Arrays;
- import java.util.Scanner;
- public class QuickSortMain {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- System.out.println("Please input the number of elements: ");
- int n = scan.nextInt(); // Въвеждаме брой елементи
- int [] arr = new int[n];
- for (int i = 0; i < n; i++) {
- System.out.printf("Please input [%d] element: ", i);
- arr[i] = scan.nextInt(); // Въвеждаме всеки елемент от масива
- }
- System.out.println("Before Sorting: " + Arrays.toString(arr)); // Масива преди сортиране
- QuickSortMethods.QuickSort(arr,0,arr.length - 1);
- System.out.println("After Sorting: " + Arrays.toString(arr)); // Масива след сортиране
- }
- }
Add Comment
Please, Sign In to add comment