arbitrarily large expected number iterations math lim n infty sum n frac math since constant expected run time many calls math theta math see big theta notation monte carlo algorithm syntaxhighlight lang pascal findinga mc array n k begin repeat randomly select one element n elements k 'a' found end syntaxhighlight ''a'' found algorithm succeeds else algorithm fails ''k'' iterations probability finding ''a'' div style text align center math pr mathrm find
Formal science Computer science Algorithms Randomized algorithms