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.

Some functions may have negative complexity and I’m worried for my crypto

3 pointsby LightMachinealmost 7 years ago

1 comment

gus_massaalmost 7 years ago
Is this just a very smart optimizer that can reduce<p><pre><code> tot=x+x+x+x+x+x+x+x+x+x+x+x+x+x+x </code></pre> to<p><pre><code> x2=x+x x4=x2+x2 x8=x4+x4 tot=x+x2+x4+x8 </code></pre> or I am missing something?<p>Note that the first code is O(N=15) and the second one is O(log(N)=4).