Using a Debugger
- Breakpoints
- Inspecting
- Stepping (Over)
- Stepping Into
- Continue
Assertions
precondition assertions
postcondition assertions
loop invariant assertions
general assertions
Java assert statement
Algorithm Efficiency
Statement Counts: SC(n)
Common Time Complexity Functions, T(n)
- 1 - Constant
- log n - Logarithmic
- n - Linear
- n log n - Log-linear
- n2 - Quadratic
- n3 - Cubic
- 2n - Exponential
- n! - Factorial
Big Oh Notation
- Used to relate a statement count to a time complexity function.
- Definition: SC(n) is O(T(n)) if and only if the limit as n
goes to infinity of
SC(n)/O(T(n)) is a non-zero constant.
- Sometimes it is useful to look at the best-case, worst-case, and
average-case time complexity of an algorithm.
Visualization