selection sort optimization
This commit is contained in:
parent
156f7a67f4
commit
dba60f03ae
|
@ -45,7 +45,9 @@ public class Selection<T extends Comparable<T>> extends Sort<T> {
|
|||
min = j;
|
||||
}
|
||||
}
|
||||
swap(nums, i, min);
|
||||
if (min != i) {
|
||||
swap(nums, i, min);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user