Preliminary Approaches
Summarized notes on Introduction to Algorithms, Chapter 20
General Notes
- - universe size;
- values can be stored in this universe
- - number of elements currently in the set
Direct addressing
- use array of bits to store values
- 1 means value is in set, 0 means it is not
- issue: long scans through elements
Superimposed binary tree
- Pair array with binary tree where array as the leaf nodes
- Each tree node summarizes its children
- Internal node will have 1 if its subtree contains 1 (logical-or)
- Update relevant binary tree nodes on insert/delete
- pro: avoid long array searches (but still not good enough)
Superimposing tree of constant height
- impose tree of degree → tree height is always 2
- each internal node still stores summary bit for its respective cluster
- issue: asymptotic time increases