How is this spatial complexity calculated in this sum?

Can someone explain to me the following calculation of the complexity of space?

Given the stream of numbers of bits of size b, calculate the sum of these numbers.

If we have seen T-numbers so far, the sum does not exceed T2 ^ b and, therefore, no more than O (b + log T) is required.

Now T2 ^ b should be the upper bound because the more precise upper bound will be T (2 ^ b - 1).

But how did they calculate that the upper bound of space is O (b + logT)?

+5
source share
1 answer

With m bits, you can store numbers up to (about) 2 m . So, working differently, if you know the sum, you need to take the logarithm to get the number of bits (and therefore the complexity of the space).

Here log (T 2 b ) = b + log (T).

+7
source

Source: https://habr.com/ru/post/1241196/


All Articles