Homework 1
- Represent the following quantities in 8 bit sign magnitude, BCD, and 8 bit twos compliment.
- Give the addition table for base 3.
- Express the following in binary.
- Complete the following table:
| Binary | Octal | Hexadecimal |
| 101101012 |   |   |
|   | 4728 |   |
|   |   | A4716 |
- Give an algorithm for adding two numbers in each of the following systems.
- BCD
- Sign Magnitude
- Stick Numbers
- Twos compliment
- Compare your algorithms, which is more efficient in terms of
- Storage
- Ease of algorithm
- Encode "O Captain! My Captain!" in ascii
- Give the binary representation
- Give the hex representation.
- Create a huffman code for the following alphabet. When constructing
your tree, always put the subtree with the smallest probability on the left
hand side, and assign a 0 to all left hand branches.
-
| Letter | Frequency |
| A | 0.07 |
| B | 0.3 |
| C | 0.15 |
| D | 0.05 |
| E | 0.25 |
| F | 0.08 |
| G | 0.09 |
| H | 0.01 |
- Encode the message ACFDGGHE
- On average, what is the cost of encoding a 20 bit message in your code?
- How many bits would a fixed length encoding for this alphabet require?
- Is your code efficient?