English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I read somewhere that if you want to get a value of n, you need to have log(base2)n.

How is that?
If I need n=8, log(base2)n is 3, so we have 3 positions:
_ _ _

000 = 0
001 = 1
010 = 2
011 = 3
100 = 4
101 = 5
110 = 6
111 = 7

As you can see, we cannot get to 8. You understand what I'm asking?

Or does that log(base2)n is actually BigO[log(base2)n]? So we don't have just 3 positions, but we have C*3 positions.
(note: C is a constant value)

I'm confused. Please help.

2007-02-05 01:44:33 · 1 answers · asked by new hope 2 in Science & Mathematics Mathematics

1 answers

Try bigger numbers.

In a computer, numbers up to 65 535 are stored in 16 bits (15 value bits and a sign bit).

Numbers up to 2 147 483 647 are stored in 32 bits (31 value bits and a sign bit).

So the space complexity of a number n is approximately log2(n) bits. It's not meant to be an exact formula.

2007-02-05 01:52:50 · answer #1 · answered by Anonymous · 0 0

fedest.com, questions and answers