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

get_random_level 这个函数 k的取值范围应该是[0, _max_level - 1]吧 #4

Open
Zhang44444 opened this issue Jul 2, 2021 · 3 comments

Comments

@Zhang44444
Copy link

如果k的取值范围[0, _max_level],那Level0应该和Level1是相等的

@Zhang44444
Copy link
Author

如果测试用例Skiplist的主键是整形,会有编译错
需要将SkipList的构造函数 改成
K k{};
V v{};

@FrazierLei
Copy link

如果k的取值范围[0, _max_level],那Level0应该和Level1是相等的

[0, max_level - 1] 还是 [1, max_level] 倒是没关系,就是按照现在的代码,会出现level0和level1是相同的
代码里所有遍历都是 [0, _skip_list_level],问题在这里

@xhh0608
Copy link
Contributor

xhh0608 commented Aug 15, 2023

如果k的取值范围[0, _max_level],那Level0应该和Level1是相等的

[0, max_level - 1] 还是 [1, max_level] 倒是没关系,就是按照现在的代码,会出现level0和level1是相同的 代码里所有遍历都是 [0, _skip_list_level],问题在这里

是的,这里需要调整成 k=0为初始值

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

No branches or pull requests

3 participants