• Correctness (proof)
  • Running time, depends on:
    • input size
    • computer
    • implementation
  1. Unit-time random access machine model
  2. Asymptotic notation

RAM model

Unit-cost model

Link to original

NOTE

Elementary operations:

  • read/write one number
  • arithmetic: +, -, *, /
  • comparisons: $<$, $=$, $\geq$

Running time in the RAM model = number of elementary operations. This corresponds to practical running time up to a constant factor.

Asymptotic notation

Definition

NOTE

is the set of possible input sizes. For , .

: order of . (equivalently: the ratio is bounded).

Example 1

,

because with .

because with .

In general, for constant :

Example 2

,

because with , .

NOTE

is the set of all functions that grow at most quadratically.

Useful tools

Example 1

.

Example 2

Let .

, because