The Word-RAM Model and Packed Representations
Use a word-size assumption to justify constant-time address and digit access, and state where multiword costs reappear.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 2
- Reading time
- 1 min
In this article2 chapters
A word can encode an address
A word-RAM has \(w\)-bit words and commonly assumes \(w\ge\lceil\log_2 n\rceil\) for addressing \(n\) locations. Fixed-size addition, comparison, shifts and bitwise operations are typical unit-cost instructions. A specific algorithm should say if it also assumes full-width multiplication or only its low word. A \(b\)-bit integer with \(b>w\) can span \(\lceil b/w\rceil\) words, restoring the need to account for carries and memory accesses.
Packed flags change the number of operations
If \(n=1000\) Boolean flags are stored in 64-bit words, one bitwise intersection needs 16 word-level operations on the packed data. The last word has 24 padding bits. Masking them before a population count preserves cardinality. Bitset dynamic programming similarly loops over words while shifted bits can cross word boundaries. External-memory analysis applies a separate model when movement between storage tiers dominates the count of these instructions.[1][2]