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 [46, Section 2.2.2].
Brodnik et al. [13] 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. Within their scheme,
the block containing
is block
, which
is simply 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 two-level
tiered-vector of Goodrich and Kloss [35].
This structure
supports the
and
operations 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: Getting this to work is really all about how you implement
the
operation. 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