Implementation of Mapping
We have seen several ways in which a mapping can be implemented:
- A function such as sqrt maps from its argument to the
- 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, TreeMap or HashMap.
- 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.