The Model of Computation
Understand the word-RAM model used to analyze the efficiency of data structure operations in C++. Learn how different types of running time guarantees—worst-case, amortized, and expected—affect performance and how space usage relates to word size.
We can analyze the theoretical running times of operations on the data structures. To do this precisely, we need a mathematical model of computation. For this, we use the w-bit word-RAM model.
Computer memory
RAM stands for Random Access Machine. In this model, we have access to a random access memory consisting of cells, each of which stores a w-bit word. This implies that a memory cell can represent, for example, any integer in the set .
In the word-RAM model, basic operations on words take constant time. This includes arithmetic operations , comparisons , and bitwise boolean operations (bitwise–AND, OR, and exclusive–OR).
Any cell can be read or written in constant time. A computer’s memory is managed by a memory management system from which we can allocate or deallocate a block of memory of any size we would like. Allocating a block of memory of size takes ...