Data Structures and Algorithms

Last Modified: 1/18/2025

1 Data Structures and Algorithms Overview

1.1 Mathematical Models

Cost Models: Use some basic operations as a proxy for running time.

OperationFrequency
Variable DeclarationN+2N + 2
Assignment StatementN+2N + 2
Less than Compare(N+1)(N+2)2\frac{\left(N + 1\right)\left(N + 2\right)}{2}
Equal to CompareN(N1)2\frac{N\left(N - 1\right)}{2}
Array AccessN(N1)N\left(N - 1\right)
IncrementN(N1)2\frac{N\left(N - 1\right)}{2} to N(N1)N\left(N - 1\right)

Key Notes:

1.2 Order-of-Growth Classifications

1.2.1 Common Classifications