From ec84f5b3efc3e2821b21433f3674fea4c7431901 Mon Sep 17 00:00:00 2001 From: Mingyue Li <3249977074@qq.com> Date: Tue, 16 Nov 2021 10:20:49 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E7=AE=97=E6=B3=95):=20=E7=AC=A6=E5=8F=B7?= =?UTF-8?q?=E8=A1=A8=E2=80=94=E2=80=94=E4=BA=8C=E5=88=86=E6=9F=A5=E6=89=BE?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E6=9C=89=E5=BA=8F=E7=AC=A6=E5=8F=B7=E8=A1=A8?= =?UTF-8?q?=E4=B8=AD=E6=8F=92=E5=85=A5=E6=96=B0=E8=8A=82=E7=82=B9=E8=80=83?= =?UTF-8?q?=E8=99=91=E5=AE=B9=E9=87=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- notes/算法 - 符号表.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/notes/算法 - 符号表.md b/notes/算法 - 符号表.md index bae9ad51..65dee38f 100644 --- a/notes/算法 - 符号表.md +++ b/notes/算法 - 符号表.md @@ -213,6 +213,8 @@ public class BinarySearchOrderedST, Value> implement values[index] = value; return; } + // 如果插入后容量大于初始化容量,则放弃当前操作(或者其他实现)。 + if (N >= keys.length) return; // 否则在数组中插入新的节点,需要先将插入位置之后的元素都向后移动一个位置 for (int j = N; j > index; j--) { keys[j] = keys[j - 1];