4 KB 内存中有多少个可寻址位?
How many addressable bits are in 4 kilobytes of memory?
我在一个问题的解决方案中遇到过以下语句:
We have 4 kilobytes of memory which means we can address up to 8 * 4 * 2^10 bits.
2^10 是从哪里来的?我本以为我们可以解决 8 * 4 * 1000 位。
供参考,问题是:
You have an array with all the numbers from 1 to N, where N is at most
32000. The array may have duplicate entries and you do not know what N is. With only 4 kilobytes of memory available, how would you print all
duplicate elements in the array?
1 KB 应该是 1000 字节,而 1 KB 是 2^10=1024。
然而,kibi* 和相关单位从未真正流行起来,所以 "kilobyte" 在实践中几乎总是意味着 1024 字节。
我在一个问题的解决方案中遇到过以下语句:
We have 4 kilobytes of memory which means we can address up to 8 * 4 * 2^10 bits.
2^10 是从哪里来的?我本以为我们可以解决 8 * 4 * 1000 位。
供参考,问题是:
You have an array with all the numbers from 1 to N, where N is at most 32000. The array may have duplicate entries and you do not know what N is. With only 4 kilobytes of memory available, how would you print all duplicate elements in the array?
1 KB 应该是 1000 字节,而 1 KB 是 2^10=1024。 然而,kibi* 和相关单位从未真正流行起来,所以 "kilobyte" 在实践中几乎总是意味着 1024 字节。