New "range-tower" data structure. 20120421030503/pspp
authorBen Pfaff <blp@cs.stanford.edu>
Fri, 26 Aug 2011 03:20:52 +0000 (20:20 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Sat, 21 Apr 2012 04:39:53 +0000 (21:39 -0700)
commit4bc7fb8814bc15858ab801be55b3b6cd79dd06e6
treed0b63d9fa6f0b15159ff6c24887c1fc4d6f58514
parent6b9ce07bad5d1d0b826c620163f777d55a1f47b3
New "range-tower" data structure.

A range tower is a bitmap, implemented as an augmented binary tree.

Beyond the usual features of a bitmap, a range tower can efficiently
implement a "splice" operation that shifts ranges of bits left or right.
This feature does cost memory and time, so use a range tower only if this
feature is actually needed.  Otherwise, use a range set (see range-set.h),
which can do everything that a range tower can do except the "splice"
operation.

Each operation has O(lg N) cost, where N is the number of contiguous
regions of 1-bits in the bitmap.  Also, a cache reduces the second and
subsequent containment tests within a single contiguous region to O(1).
src/libpspp/automake.mk
src/libpspp/range-tower.c [new file with mode: 0644]
src/libpspp/range-tower.h [new file with mode: 0644]
tests/automake.mk
tests/libpspp/range-tower-test.c [new file with mode: 0644]
tests/libpspp/range-tower.at [new file with mode: 0644]