TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Morris Algorithm (2014)

43 点作者 kashifr超过 10 年前

2 条评论

darkmighty超过 10 年前
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}.
seniorghost超过 10 年前
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 未加载