javascript - Algorithm for consecutive n-head -


i have tackle statistics problem current project: given series of coin flips, calculate percentage of consecutive n-heads runs. data bellow, 1 head , 0 tail. found this reference probability of n-heads , have no clue of how apply deride algorithm (javascript prefered). appreciate hints. thanks!

flips = [1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0. 0];

edit:

  1. the coin not fair coin next outcome of flip based on history. example, don't see 3-tails run (3 zeroes in row) in history chance of next outcome 0%.

  2. so, interpretation of percentage of consecutive n-heads runs probability of outcome of next flip. :)


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -