Most of the data structures described in this chapter are folklore. They
can be found in implementations dating back over 30 years. For example,
implementations of stacks, queues, and deques which generalize easily
to the
,
and
structures described
here are discussed by Knuth [41, Section 2.2.2].
Brodnik et al. [11] seem to have been the first to describe
the
and prove a
lower-bound like that
in Section 2.6.2. They also present a different structure
that uses a more sophisticated choice of block sizes in order to avoid
computing square roots in the
method. With their scheme, the
block containing
is block
, which is just
the index of the leading 1 bit in the binary representation of
.
Some computer architectures provide an instruction for computing the
index of the leading 1-bit in an integer.
A structure related to the
is the
-level
tiered-vector of Goodrich and Kloss [32]. This structure
supports
and
in constant time and
and
in
time. These running times are similar
to what can be achieved with the more careful implementation of a
discussed in Exercise 2.10.
Hint: Making this work is really all about how a
operation is performed. You would like
to put the data
structure into a state where the data cannot run off either end until
at least
operations have been performed.
Test the performance of your implementation against the
.
Optimize your implementation (by using
)
and see if you can get it to outperform the
implementation.
opendatastructures.org