[英]Skip list with unfair coin
So I've been studying skip lists in school and we briefly spoke about if we were to use an 'unfair coin' in a skip list rather than a fair coin, (example: probability of the unfair coin flip resulting in a value of "Heads" is set to p where 0 < p < 1 (so that the probability of "Tails" is 1 −p). 因此,我在学校里研究了跳过清单,我们简短地谈到了如果要在跳过清单中使用“不公平硬币”而不是公平硬币,(例如:不公平硬币翻转的概率导致“ “头”设置为p,其中0 <p <1(因此,“尾巴”的概率为1 -p)。
There are a few things I've wondered about this that I don't really understand as we passed over the topic so quickly. 当我们如此迅速地通过话题时,我对此有些疑惑,但我对此并不太了解。
What would happen to the height/size of a skip list if we did this? 如果我们这样做,跳过列表的高度/大小会怎样? It would obviously change things if the probability was skewed, right?
如果概率不正确,那显然会改变事情,对吗? Say it contained arbitrary n elements, obviously the heights would be different than if we used a fair coin.
假设它包含任意n个元素,显然高度与使用公平硬币的高度不同。
How would the expected number of promotions that would be received by an arbitrary node when adding it to the skip list change? 将任意节点添加到跳过列表时,预期将收到的促销数量如何变化? I don't know if it would in this scenario but it was a topic of discussion.
我不知道这种情况是否会发生,但这是讨论的话题。
I'm not looking for someone to just give answers without me actually understanding, but if you could actually explain why these changes are happening so that I can understand how it is being affected by a change in probability, I would appreciate it. 我不是要有人在没有我真正理解的情况下给出答案,但是如果您能真正解释为什么会发生这些变化,以便让我能够理解它受到概率变化的影响,我将不胜感激。
EDIT: I think I now understand after doing some comparisons of different probabilities with the equation provided on page 99 of Pat Morin's Open Data Structures book. 编辑:我想在用Pat Morin的《开放数据结构》一书第99页提供的方程式对不同概率进行一些比较之后,我现在可以理解。 I'll post my solution in the comments once I figure it out in order to help others with the same question.
一旦找到解决方案,我就会在评论中发布我的解决方案,以帮助其他有相同问题的人。
You can look up the answers to your questions here: https://en.wikipedia.org/wiki/Skip_list#Description 您可以在此处查找问题的答案: https : //en.wikipedia.org/wiki/Skip_list#Description
I will try to explain them: 我将尝试解释它们:
Let p be the probability for an element to be promoted to the next level, then 令p为将元素提升到下一个级别的概率,则
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.