7

In book Algorithms fourth edition by Robert Sedgewick on page 200, it says "for example, if you have 1GB of memory on your computer (1 billion bytes), you cannot fit more than about 32 million int values."

I got confused after my calculation: 1,000,000,000 bytes/4 bytes = 250 million

How the author got 32 million?

The book describes like below:

enter image description here

4

2 回答 2

7

作者已经承认这是本书网站的错误,请参考以下链接:http: //algs4.cs.princeton.edu/errata/errata-printing3.php

于 2016-02-22T22:19:55.127 回答
5

1 千兆 = 1073741824 位
1 int = 32 位
计算 = (1073741824/32) = (32 * 1024 2 ) = (32 * 2 20 ) = 3200 万

如果作者的意思是千兆字节,那么答案将是 (32 * 8) 百万 = 2.56 亿

于 2016-02-22T10:41:52.300 回答