Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library
← Back to context

Comment by sannysanoff

4 months ago

while both versions are O(N^2), your version is slower because comparison operation, which affects execution speed. This is suboptimal.

  q)x:1000
  q)\t:1000 sum (til x)=/:(til x)
  889
  q)\t:1000 sum (til x)=/:(til x)
  871
  q)\t:1000 sum (2#x)#1,x#0
  602
  q)\t:1000 sum (2#x)#1,x#0
  599

upd: in ngn/k, situation is opposite ;-o

0 comments

sannysanoff

Reply

No comments yet

Contribute on Hacker News ↗

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities