Skip to content
New issue

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

[2018-12-02] 使用JavaScript实现SkipList这种数据结构 #1

Closed
dreamapplehappy opened this issue Dec 4, 2018 · 3 comments
Closed

Comments

@dreamapplehappy
Copy link
Owner

关于这篇文章,大家有什么想法可以在这里提出来

@dreamapplehappy dreamapplehappy changed the title [2018-12-12] 使用JavaScript实现SkipList这种数据结构 [2018-12-02] 使用JavaScript实现SkipList这种数据结构 Dec 14, 2018
@kkdev163
Copy link

赞,实现的还是很简洁的。

@kkdev163
Copy link

kkdev163 commented Feb 27, 2019

对于数据结构的示意图,还有P.ref[level-1]的理解,与您有些出入。。以下是我理解的示意图:
image

@mysteryven
Copy link

个人认为 p.refer[i-1] 不是指向的下一层节点,而是和 p.refer[i] 在同一数组的,只比它 index 小一的节点,也就是你在图中表示的 p.refer[i-1] 的下一个节点。

假设我们执行插入操作的 update 数组碰巧都是一竖列那种,也就意味着 update 数组的每一项都是相同的:

newNode[0] = update[0].refer[0]
newNode[1] = update[1].refer[1]
newNode[2] = update[1].refer[2]
...

而此时 update[0] === update[1] === update[2]

所以也就意味着refer[i-1]不是题主图画的那样呢。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants