| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,18 +1,18 @@ | |||
| 1 | 1 | package org.algorithm.array.sort.client; | |
| 2 | 2 | ||
| 3 | - import org.algorithm.array.sort.impl.OddEvenSort; | ||
| 3 | + import org.algorithm.array.sort.impl.QuickSort; | ||
| 4 | 4 | import org.algorithm.array.sort.interf.Sortable; | |
| 5 | 5 | import org.utils.naga.containers.ArrayUtils; | |
| 6 | 6 | ||
| 7 | 7 | public class SortClient { | |
| 8 | 8 | ||
| 9 | 9 | public static void main(String[] args) { | |
| 10 | - int[] array = {34, 23, 76, 56, 54, 12, 34, 65, 45, 9, 8, 7, 6, 5}; | ||
| 10 | + // int[] array = {34, 23, 76, 56, 54, 12, 34, 65, 45, 9, 8, 7, 6, 5}; | ||
| 11 | 11 | // int[] array = {34, 23, 98, 76, 56, 45}; | |
| 12 | 12 | // int[] array = {23, 34, 54, 56, 76, 98}; | |
| 13 | - // int[] array = {6, 5, 4, 3, 2, 1}; | ||
| 13 | + int[] array = {3, 4, 1, 7, 6, 2, 0}; | ||
| 14 | 14 | ArrayUtils.show(array); | |
| 15 | - Sortable sortable = new OddEvenSort(); | ||
| 15 | + Sortable sortable = new QuickSort(); | ||
| 16 | 16 | array = sortable.sort(array); | |
| 17 | 17 | ArrayUtils.show(array); | |
| 18 | 18 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,7 @@ | |||
| 1 | 1 | package org.algorithm.array.sort.impl; | |
| 2 | 2 | ||
| 3 | + import java.util.Arrays; | ||
| 4 | + | ||
| 3 | 5 | import org.algorithm.array.sort.interf.Sortable; | |
| 4 | 6 | ||
| 5 | 7 | /** | |
@@ -41,6 +43,8 @@ private void sortCore(int[] array, int startIndex, int endIndex) { | |||
| 41 | 43 | ||
| 42 | 44 | int boundary = boundary(array, startIndex, endIndex); | |
| 43 | 45 | ||
| 46 | + System.err.println(Arrays.toString(array)); | ||
| 47 | + | ||
| 44 | 48 | sortCore(array, startIndex, boundary - 1); | |
| 45 | 49 | sortCore(array, boundary + 1, endIndex); | |
| 46 | 50 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments