TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Morris Algorithm (2014)

43 pointsby kashifrover 10 years ago

2 comments

darkmightyover 10 years ago
I like that this algorithm shows the strength of non-determinism. You simply cannot achieve lower than O(log n) bits in a deterministic way for a counter.<p>It&#x27;s also neat that you can trivially extend this to O(log log ... log n) by making the increment probability 2^(2^(... 2^(-X), all the way up to O(log* n).<p>To the ones questioning the usefulness of this, note that this is essentially equivalent to floating point arithmetic, where X is the exponent (and eps dictates mantissa size). This shows you can do all sorts of unbiased operations just like you would with floating point values. For example, you can add counter A and B e.g. A=10 B=8 by taking C=&quot;A+B&quot;=max(A,B)+{1 with prob 2^-(|A-B|+1)}=10+{1 with prob 2^-3}.
seniorghostover 10 years ago
Honest question: What&#x27;s the use of compressing the counter for n smaller than log(n) bits? Even if you were counting something on the order of 10^30, log n is only around 100 bits. Wouldn&#x27;t storing the algorithm take more space than you&#x27;d save through this counter?
评论 #9023317 未加载
评论 #9023309 未加载