auto commit

This commit is contained in:
CyC2018 2019-02-26 15:25:19 +08:00
parent cc9dd446f2
commit d526ebd5fd
4 changed files with 5 additions and 7 deletions

View File

@ -403,12 +403,10 @@ public List<Integer> topKFrequent(int[] nums, int k) {
}
List<Integer> topK = new ArrayList<>();
for (int i = buckets.length - 1; i >= 0 && topK.size() < k; i--) {
if (buckets[i] != null) {
if (buckets[i].size() <= (k - topK.size())) {
topK.addAll(buckets[i]);
} else {
topK.addAll(buckets[i].subList(0, k - topK.size()));
}
if (buckets[i].size() <= (k - topK.size())) {
topK.addAll(buckets[i]);
} else {
topK.addAll(buckets[i].subList(0, k - topK.size()));
}
}
return topK;

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

View File

@ -382,7 +382,7 @@ public class Insertion<T extends Comparable<T>> extends Sort<T> {
希尔排序使用插入排序对间隔 h 的序列进行排序。通过不断减小 h最后令 h=1就可以使得整个数组是有序的。
<div align="center"> <img src="pics/1_200.png"/> </div><br>
<div align="center"> <img src="pics/cb5d2258-a60e-4364-94a7-3429a3064554_200.png"/> </div><br>
```java
public class Shell<T extends Comparable<T>> extends Sort<T> {

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB