CSci2110 - Assignment 3
Due: Tuesday Feb. 27 by 11:55pm
Revisions History:
Assignment Goals:
Caching is a very powerful idea in computer
science, one that plays an important role in the design of systems from
processors to databases. The idea is that if some piece of data is expensive to
compute (or request from another system) then maybe it is worth keeping a copy
in case it is required again. A cache is a high speed storage repository for
temporary data. All of these operations should run in expected O(1) time. Submit your write up
for this question as a MSWord or .pdf file. This is a design exercise in which
you will be marked on the clarity, simplicity, and efficiency of your solution.
Draw pictures! You may design a composite data structure that uses other data
structures as helpers. In your analysis you should focus on expected case
performance but also discuss worst-case performance. Be sure follow all of the code craft
requirements carefully! Be sure to do sufficient testing! You are to use
only code that you have developed yourself for this assignment. Note: No late assignments will be accepted.
For example, web browsers typically maintain a cache of recently visited pages
and images so that if they are requested again they can be accessed locally
rather than being re-transferred over the network . There also may be network-based
web caches as illustrated below.

From http://www.cisco.com/univercd/illus/1/93/111393.jpg.
It might be nice to have an infinite size cache, but that is not practical so
caches are typically designed to have some given fixed size and use some kind of
cache replacement policy to determine what to do when the cache is full. One
popular replacement policy,
LRU, replaces the Least Recently Used entry if the
cache is full. The replacement policy must also decide where in the cache a copy
of a particular entry will go. If the replacement policy is free to choose any
entry in the cache to hold the copy, the cache is called fully associative.
Your Task