Fog Creek Software
Discussion Board




"sum it up" -- solution is wrong

The solution is wrong because the sum of n numbers takes a storage amount which is proportional to n. The solution given states that the sum actually takes constant space.

(e.g.) You wouldn't expect the sum of numbers 1 to 1000000000000000000000000000000000000000 to fit in a 32-bit integer, would you?

Tim
Tuesday, February 17, 2004

To be atrociously pedantic, storage is log base 2 of n, which might as well be constant for numbers mere mortals use.

Jason McCullough
Wednesday, March 03, 2004

*  Recent Topics

*  Fog Creek Home