forked from IvanLu1024/Java-Notes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSort.java
More file actions
19 lines (15 loc) · 371 Bytes
/
Sort.java
File metadata and controls
19 lines (15 loc) · 371 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package code_00_basicSort;
/**
* Created by 18351 on 2019/1/10.
*/
public abstract class Sort<T extends Comparable<T>> {
public abstract void sort(T[] arr);
protected boolean less(T v, T w) {
return v.compareTo(w) < 0;
}
protected void swap(T[] arr, int i, int j) {
T t = arr[i];
arr[i] = arr[j];
arr[j] = t;
}
}