|
1 | | -Project |
2 | | ------------ |
3 | | -<br/> |
4 | 1 |
|
5 | | -#### Java |
6 | 2 |
|
7 | | - |
8 | | - |
9 | | - |
10 | | -> - Java로 구현 한 정렬 알고리즘 폴더들이 있습니다. |
11 | | -> - Java11 API : [Java API](https://docs.oracle.com/en/java/javase/11/docs/api/index.html) |
12 | | -> - 특별한 경우를 제외하고는 사용자 객체의 정렬까지 지원합니다. |
13 | | -> - 사용자 객체(클래스)를 정렬하는 경우 Comparator 또는 Comparable에 의해 비교방식을 구현해주어야 하며, 형식은 표준 Java 작성법과 동일합니다. |
14 | | -
|
15 | | -</br></br> |
16 | | -#### [Preview subFolder] |
17 | | -> - SelectionSort : Selection sort(선택 정렬)를 구현한 소스코드가 있습니다. |
18 | | -> - InsertionSort : Insertion sort(삽입 정렬)를 구현한 소스코드가 있습니다. |
19 | | -> - BubbleSort : Bubble sort(거품 정렬)을 구현한 소스코드가 있습니다. |
20 | | -> - ShellSort : Shell sort(셸 정렬)을 구현한 소스코드가 있습니다. |
21 | | -> - HeapSort : Heap sort(힙 정렬)을 구현한 소스코드가 있습니다. |
22 | | -> - MergeSort : Merge sort(합병/병합 정렬)을 구현한 소스코드가 있습니다. |
23 | | -> - QuickSort : Quick sort(퀵 정렬)을 구현한 소스코드가 있습니다. |
24 | | -
|
25 | | - |
26 | | - |
27 | | -<br/><br/> |
28 | | - 블로그에서 포스팅과 동시에 지속적으로 업데이트 예정 |
29 | | - |
30 | | - |
31 | | -<br/><br/> |
32 | | -<br/><br/> |
33 | | - |
34 | | ------------------ |
35 | | - |
36 | | - |
37 | | -#### How to Use (download ZIP) on Eclipse |
38 | | -<br/> |
39 | | - |
40 | | -- **1. Project import** <br /> <br /> Window -> File -> New -> Java Project -> uncheck the **"Use default location"** and Browse the **SortingAlgorithm** folder |
41 | | --> Finish |
42 | | - |
43 | | -<br /><br /> |
44 | | - |
45 | | -- **2. Build path** <br /> <br /> Your Project -> Build Path -> Configure Build Path -> Project -> select the class path -> add -> Select **SortingAlgorithm** -> Apply and Close |
46 | | - |
47 | | -<br /><br /> |
48 | | - |
49 | | -- **3. import class** |
50 | | - |
51 | | -``` |
52 | | -import [sorting algorithm package name].[sorting algorithm name]; |
53 | | -``` |
| 3 | +# NOTE |
54 | 4 |
|
55 | 5 | </br></br></br> |
56 | 6 |
|
57 | | -**All sorting methods are static methods.** |
58 | | - |
59 | | -```java |
60 | | -//ex. |
61 | | - |
62 | | -import BubbleSort.BubbleSort; |
| 7 | +## QuickSort |
63 | 8 |
|
64 | | -class YourClass { |
65 | | - public static void main { |
66 | | - int[] a = {1, 5, 2, 4}; |
67 | | - BubbleSort.sort(a); |
68 | | - } |
69 | | -} |
70 | | -``` |
| 9 | +</br> |
71 | 10 |
|
72 | | -</br></br></br> |
73 | | - |
74 | | -**If you want to sort an array of primitive types in reverse order, use it as in the following example.** |
| 11 | +Quick sort has 3 types based on pivot selection. |
75 | 12 |
|
76 | | -```java |
77 | | -//ex. |
78 | 13 |
|
79 | | -import BubbleSort.BubbleSort; |
80 | | - |
81 | | -class YourClass { |
82 | | - public static void main { |
83 | | - int[] a = {1, 5, 2, 4}; |
84 | | - // true : reverse order, false : nature order |
85 | | - BubbleSort.sort(a, true); |
86 | | - } |
87 | | -} |
88 | | -``` |
| 14 | +> - QuickSort : implemented with middle element selected as the pivot (standard) |
| 15 | +> - LPQuickSort : implemented with left element selected as the pivot |
| 16 | +> - RPQuickSort : implmemented with right element selected as the pivot |
89 | 17 |
|
90 | 18 | </br></br></br> |
91 | 19 |
|
| 20 | +## ParallelSort |
92 | 21 |
|
93 | | -**If you want to sort an array of Wrapper types in reverse order, use it as in the following example.** |
94 | | - |
| 22 | +</br> |
95 | 23 |
|
96 | | -```java |
97 | | -//ex. |
| 24 | +Sorting algorithm in this package uses **threading**. |
98 | 25 |
|
99 | | -import BubbleSort.BubbleSort; |
100 | | -import Utils.Order; |
101 | 26 |
|
102 | | -class YourClass { |
103 | | - public static void main { |
104 | | - Integer[] a = {1, 5, 2, 4}; |
105 | | - BubbleSort.sort(a, Order.reverseOrder()); |
106 | | - // or Collections.reverseOrder() (in java.util package) |
107 | | - } |
108 | | -} |
109 | | -``` |
110 | | -<br/> |
111 | | - |
112 | | -``` |
113 | | -Note : reverseOrder() method is in Utils.Order. |
114 | | -``` |
115 | | - |
116 | | -</br></br></br> |
117 | | -<br/> |
118 | | - |
119 | | -``` |
120 | | -Note |
121 | | -
|
122 | | -class QuickSort -> standard QuickSort (with middle element selected as pivot) |
123 | | -class LPQuickSort -> left-pivot QuickSort |
124 | | -class RPQuickSort -> right-pivot QuickSort |
125 | | -``` |
126 | | - |
127 | | -</br></br></br> |
| 27 | +> - ParallelLPQuickSort (left pivot quick sort with threading) |
128 | 28 |
|
| 29 | +</br> |
129 | 30 |
|
130 | | -<br/><br/> |
| 31 | +`to be updated..` |
131 | 32 |
|
132 | | ------------------ |
133 | 33 |
|
134 | | -#### 구현 대한 내용은 블로그에 기재하고 있습니다. |
135 | | -<br/> |
136 | 34 |
|
137 | | -- [Stranger's LAB](https://st-lab.tistory.com/category/알고리즘/Java) |
138 | | -<br/> |
139 | | - 부분적으로 추가 구현 또는 차이가 있을 수 있습니다. |
140 | 35 |
|
141 | | -<br/><br/> |
142 | 36 |
|
143 | 37 |
|
0 commit comments