Hacker News new | ask | show | jobs
by dirtydroog 2307 days ago
> It takes O(n*n) time to add the n integers.

Eh?

2 comments

The time complexity assumption for addition is given earlier in the article.
From the article:

> We will be dealing with arbitrary precision integers (bignums) in the problem, so let us also make a few assumptions:

> Addition or subtraction of an m-bit integer and an n-bit integer (m <= n) takes O(n) time.

> Counting the number of 1-bits in an n-bit integer takes O(n) time.