Contents
Page-10
Prev
Next
Page+10
Index
Implementation of Mapping
A mapping can be implemented in several ways:
- A function such as sqrt maps from its argument to the
target value.
- If the domain is a finite, compact set of integers, we can store
the target values in an array and look them up quickly.
- If the domain is a finite set, we can use a lookup table such
as an association list or map data structure such as
TreeMap or HashMap in Java or the Clojure maps based on them.
- If the domain is a finite set represented as an array
or linked list, we can
create a corresponding array or list of target values.