跳表删除元素后,需要更新levelcount
This commit is contained in:
parent
31b0908077
commit
fa95fa8b90
@ -79,6 +79,11 @@ public class SkipList {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while (levelCount>1&&head.forwards[levelCount]==null){
|
||||
levelCount--;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 随机 level 次,如果是奇数层数 +1,防止伪随机
|
||||
|
Loading…
Reference in New Issue
Block a user