Skip to content

Commit

Permalink
Merge pull request #3 from lucher/master
Browse files Browse the repository at this point in the history
[TimSort] filter empty list
  • Loading branch information
leonchen83 authored Dec 29, 2023
2 parents e4c4e2d + 035c311 commit 4193ab7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/cn/nextop/TimArrSort.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ private void init() {
* Sorts the given range
*/
public static <T> void sort(List<T[]> a, Comparator<? super T> c) {
if(a.size() == 0) return;
var ts = new TimArrSort(a, c);
int base = 0; for (T[] t : a) {
int l = t.length; if (l == 0) continue;
Expand Down Expand Up @@ -312,7 +313,6 @@ private void initLoc() {
private void skipEmpty() { /* skip */
int rs = lens.length - 1;/* last row */
while (row < rs && lens[row] == 0) row++;
assert !(row == rs && this.lens[row] == 0);
}

private void locate(int i) { /* for read */
Expand Down

0 comments on commit 4193ab7

Please sign in to comment.