## My Solutions For Programming Pearls Column 1

## Problem 1

If memory were not scarce, how would you implement a sort in a language with libraries for representing and sorting sets?

I would prefer to use Map-Reduce to do the sorting.

## Problem 5

Easy, whereas still made me confused without knowing that, **the phone number in the U.S. doesn't begin with 1 as well as 0!**

If the number range begin with 0 and 1 are removed, the remaining cost of memory is:

`10^7bit - 2 * 10^6bit = 8 * 10^bit = 1MB`

exactly how much the available memory is.

## Problem 6

Easy.

Since each integer could not appear more than once, we can represent the appearance by using one digit of decimal instead of a boolean value. And one digit decimal can be stored within 4bits, so the bit-to-decimal transformation is 4-time larger:

`10^7bit * 4 = 4 * 10^7bit = 5MB`