# RAM machine

Jump to navigation
Jump to search

A RAM machine, or Random Access Machine, is a computational model designed to analyze algorithm complexity.

It has an infinite number of registers, numbered `R[0]`

, `R[1]`

, `R[2]`

, ...

The model assumes constant time for reading, writing, and computational operations. Some of these operations include:

`R[i] <- c`

`R[i] <- R[j]`

`R[i] <- R[R[j]]`

`R[R[i]] <- R[j]`

`R[i] <- R[j] + R[k]`

`R[i] <- R[j] - R[k]`

`IF R[i] = 0 GOTO lbl`

`IF R[i] > 0 GOTO lbl`

`GOTO lbl`

`STOP`