RAM Model of Computation
Abstract machine model for analyzing algorithm complexity, with O(1) random memory access.
Abstract machine model for analyzing algorithm complexity, with O(1) random memory access.
The Random Access Machine (RAM) is an abstract model of computation that abstracts the structure of real computers to focus on how Algorithms process information.
Memory is modeled as an infinite sequence of cells (also called words), each storing a fixed-width integer.
The model has a single processor that performs basic operations:
Key assumption: algorithms run sequentially, not in parallel. One operation at a time.
All operations in the instruction set execute in time:
| Category | Operations |
|---|---|
| Data movement | load, store, copy |
| Arithmetic | add, subtract, multiply, divide |
| Logical | AND, OR, NOT, XOR, shift |
| Control flow | jump, branch, call, return |
The RAM model lets us analyze algorithm complexity independently of hardware:
T(n) = number of RAM instructions executed
S(n) = number of memory cells used
This gives us the clean -notation complexity we use in practice. The model is accurate enough for most algorithms but breaks down for: