阅读背景:

5. Exercises and Problems——Introduction to Algorithms Third Edition

来源:互联网 

Exercises 5.1-3.


因为Pr{x=0 and y=1} = Pr{x=1 and y=0} = (1-p)*p,所以返回0 或 1的概率相等,均为1/2。最后要求其时间复杂度,等价于求算法迭代次数的期望。在每一次迭代中,成功的概率为2(1-p)*p,类似于因为Pr{x=0 and y=1} =




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: