We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
由于老师的代码,在levelCount-1处是有值的,如果如老师代码所写 while (levelCount>1&&head.forwards[levelCount]==null){ levelCount--; } 则,跳表中node的maxLevel会与外层的levelCount不一致 正确代码应该是: while (levelCount>1&&head.forwards[levelCount-1]==null){ levelCount--; }
while (levelCount>1&&head.forwards[levelCount]==null){ levelCount--; }
while (levelCount>1&&head.forwards[levelCount-1]==null){ levelCount--; }
The text was updated successfully, but these errors were encountered:
多遍历了一次而已也不会有数组越界的问题
Sorry, something went wrong.
老师原来代码删除确实会有问题的,我在项目中使用跳表,原来的代码会在使用randomLevel()后导致程序出现随机的删除失效的问题。经过排查,改成该ISSUE的代码可以正确删除。
No branches or pull requests
由于老师的代码,在levelCount-1处是有值的,如果如老师代码所写
while (levelCount>1&&head.forwards[levelCount]==null){ levelCount--; }
则,跳表中node的maxLevel会与外层的levelCount不一致
正确代码应该是:
while (levelCount>1&&head.forwards[levelCount-1]==null){ levelCount--; }
The text was updated successfully, but these errors were encountered: