Previous Lecture lect03 Next Lecture

lect03,

Running time analysis

Code from lecture

https://github.com/ucsb-cs24-w26/cs24-w26-lectures/tree/main/lect03

Lecture prereading

Topics

Key Definitions

Time Complexity

The time complexity of an algorithm is the number of constant-time operations it performs as a function of the input size. We express this using Big-O notation, which captures the growth rate and ignores constant factors and lower-order terms.

Examples:

Space Complexity

The space complexity of an algorithm is the amount of auxiliary (extra) memory it uses as a function of the input size. Auxiliary space does not count the memory used by the input or the output — it only counts the additional memory the algorithm needs to compute the result. This includes:

Examples: