CS/APMA 302 Discrete Math II, Professor Brogan

# Assignment 1

Due: In class Tuesday, January 23rd, 2001

Read The Library of Babel by Jose Luis Borges

## Average: 85.14 Median: 85

• How many distinct books are there in the library?

We have 25 different symbols in the alphabet.
Each book has 410 pages.
Each page has 40 lines.
Each line has 80 characters.
The number of distinct books is equal to the number of ways the 25 symbols in the alphabet can be arranged throughout all the characters in the book

25 ^ (80 * 40 * 410) = 25 ^ 1,312,000

Careful readers will note that the letters on the spine could also be used to distinguish between different books. Few specifications on the spine are given. We ignore the spine for this question.

• List three words that were "new" to you and give the appropriate definitions of each.
• Any words were acceptible.

• How long would it take to determine that each book in the library is unique?
• To answer this, we ensure that each book is different from every one of the other (25^1,312,000 - 1) books.

One could sort all the books in alphabetical order, O(n log n), and then walk through the entire list comparing each book to the one immediately following, O(n).

One could compare each book to all the other books, O (n^2).

One could create a bit string 25^1,312,000 bits long. Each bit in the bit string corresponds to one possible permutation of the symbols in a book. Iterate through each of the 25^1,312,000 books and set the bit in the bit string that corresponds to the particular string of symbols found in the book, O(n). If any bit is switched more than once, a duplicate occured.