Merge ec84f5b3efc3e2821b21433f3674fea4c7431901 into 456ff183d550baba9f1f5f54a3f736a5089f1cb2

This commit is contained in:
Mingyue Li 2021-11-16 10:21:05 +08:00 committed by GitHub
commit cf6d7fccf6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -213,6 +213,8 @@ public class BinarySearchOrderedST<Key extends Comparable<Key>, Value> implement
values[index] = value;
return;
}
// 如果插入后容量大于初始化容量则放弃当前操作或者其他实现
if (N >= keys.length) return;
// 否则在数组中插入新的节点需要先将插入位置之后的元素都向后移动一个位置
for (int j = N; j > index; j--) {
keys[j] = keys[j - 1];