From d4bd9e7c7de90310c1c77e78718c11d4d049d648 Mon Sep 17 00:00:00 2001 From: nik Date: Mon, 9 Apr 2018 15:50:48 +0300 Subject: [PATCH] Replaced the left sorts to the new package --- Sorts/cyclesort.java | 78 ------------------- Sorts/{ => src/sort}/HeapSort.java | 0 .../sort/RadixSort.java} | 16 ++-- 3 files changed, 8 insertions(+), 86 deletions(-) delete mode 100644 Sorts/cyclesort.java rename Sorts/{ => src/sort}/HeapSort.java (100%) rename Sorts/{radixSort.java => src/sort/RadixSort.java} (83%) diff --git a/Sorts/cyclesort.java b/Sorts/cyclesort.java deleted file mode 100644 index 5b7e5652..00000000 --- a/Sorts/cyclesort.java +++ /dev/null @@ -1,78 +0,0 @@ -import java.util.*; -import java.lang.*; - -class Sorting -{ - // Function that sort the array using Cycle sort - public static void cycleSort (int arr[], int n) - { - // count number of memory writes - int writes = 0; - - // traverse array elements - for (int cycle_start=0; cycle_start<=n-2; cycle_start++) - { - // initialize item as starting point - int item = arr[cycle_start]; - - // Find position where we put the item. - int pos = cycle_start; - for (int i = cycle_start+1; i mx) mx = arr[i]; return mx; } - - static void countSort(int arr[], int n, int exp) + + private static void countSort(int arr[], int n, int exp) { int output[] = new int[n]; int i; @@ -35,8 +36,7 @@ class Radix { arr[i] = output[i]; } - static void radixsort(int arr[], int n) - { + private static void radixsort(int arr[], int n) { int m = getMax(arr, n);