Padova · IT
◑ GROWING NOTE algorithmscs-fundamentalstheory

RAM Model of Computation

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.

Major Components

Memory

Memory is modeled as an infinite sequence of cells (also called words), each storing a fixed-width integer.

Processor

The model has a single processor that performs basic operations:

Key assumption: algorithms run sequentially, not in parallel. One operation at a time.

Instruction Set

All operations in the instruction set execute in O(1)O(1) time:

CategoryOperations
Data movementload, store, copy
Arithmeticadd, subtract, multiply, divide
LogicalAND, OR, NOT, XOR, shift
Control flowjump, branch, call, return

Why This Model Matters

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 OO-notation complexity we use in practice. The model is accurate enough for most algorithms but breaks down for: