Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
该 PR 修改点如下:
以下是修改后的表达及逻辑:
将变量名 "leveCount" 修改为 "levelCount"。
修改手写跳表中 delete 方法的逻辑。由于数组下标从 0 开始,因此在检查是否有一级索引为空时,应该使用 "levelCount - 1" 作为索引条件。这样可以确保在实际存在目标索引层级为空时,能正确减少层级计数,避免后续无法使用存在的高层级索引以及无法回收高层级孤儿索引的情况发生。
修改后的代码如下:
这样可以确保正确处理跳表中的索引层级,避免出现索引层级计数错误以及无法使用或回收索引的问题。