Go to the previous, next section.
Maps support associative array operations (insertion, deletion, and membership of records based on an associated key). They require the specification of two types, the key type and the contents type.
These are currently implemented in several ways, differing in representation strategy, algorithmic efficiency, and appropriateness for various tasks. (Listed next to each are average (followed by worst-case, if different) time complexities for [a] accessing (via op [], contains), [d] deleting elements).
AVLMaps
RAVLMaps
ranktoPix(int r)
, that returns the Pix
of the
item at rank r, and rank(key)
that returns the
rank of the corresponding item.
([a O(log n)], [d O(log n)]).
SplayMaps
VHMaps
CHMaps
The different implementations differ in whether their constructors
require an argument specifying their initial capacity. Initial
capacities are required for hash table based Maps. If none is
given DEFAULT_INITIAL_CAPACITY
(from `<T>defs.h') is
used.
All Map classes share the following operations (for some Map class,
Map
instance d
, Pix ind
and key variable k
,
and contents variable x
).
Pix-based operations are more fully described in the section on Pixes. See section Pseudo-indexes
Map d(x); Map d(x, int initial_capacity)
d.empty()
d.length()
d[k]
d.contains(k)
d.del(k)
d.clear()
x = d.dflt()
k = d.key(ind)
x = d.contents(ind)
ind = d.first()
d.next(ind)
ind = d.seek(k)
Go to the previous, next section.