update
This commit is contained in:
parent
1f1ad49427
commit
6f050a029e
2496 changed files with 37609 additions and 3031 deletions
|
|
@ -1,7 +1,7 @@
|
|||
public static <E extends Comparable<? super E>> List<E> quickSort(List<E> arr) {
|
||||
if (arr.size() <= 1)
|
||||
return arr;
|
||||
E pivot = arr.getFirst(); //This pivot can change to get faster results
|
||||
if (!arr.isEmpty()) {
|
||||
E pivot = arr.get(0); //This pivot can change to get faster results
|
||||
|
||||
|
||||
List<E> less = new LinkedList<E>();
|
||||
List<E> pivotList = new LinkedList<E>();
|
||||
|
|
@ -25,4 +25,7 @@ public static <E extends Comparable<? super E>> List<E> quickSort(List<E> arr) {
|
|||
less.addAll(pivotList);
|
||||
less.addAll(more);
|
||||
return less;
|
||||
}
|
||||
return arr;
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue