Problem 5 : Algorithms & Data Structures
- Suppose that a hash function is defined as H(X)=X%9, where
X is the 16-bit integer input and % represents the
modulus (remainder) function. How many total bytes of memory
would be required to store both the hash table and data
for a program which tracks the occurances of repeating inputs using
8-bit counters.
(6 pts)
- For the Hanoi machine problem, how many steps were necessary to
move all N tiers from one location to another.
(Specify your answer as a function of N).
(7 pts)
- For the Lunar Lander, what mathematical function was
performed within the timer interrupt to compute a new Y-position?
Specify your answer as a function of existing position, velocity,
thrust, and gravity.
(7 pts)
- Explain why a macro cannot be recursive.
(5 pts)