Content deleted Content added
redundant link |
m Bot: Replace deprecated <source> tag and "enclose" parameter [https://lists.wikimedia.org/pipermail/wikitech-ambassadors/2020-April/002284.html] |
||
Line 20:
Las Vegas algorithm:
<
findingA_LV(array A, n)
begin
Line 27:
until 'a' is found
end
</syntaxhighlight>
This algorithm succeeds with probability 1. The number of iterations varies and can be arbitrarily large, but the expected number of iterations is
Line 36:
Monte Carlo algorithm:
<
findingA_MC(array A, n, k)
begin
Line 45:
until i=k or 'a' is found
end
</syntaxhighlight>
If an ‘''a''’ is found, the algorithm succeeds, else the algorithm fails. After ''k'' iterations, the probability of finding an ‘''a''’ is:
<div style="text-align:center;">
|