1/14
Looks like no tags are added yet.
What does O(1) mean?
Constant time. Runtime does not increase as n increases.
What does O(log n) mean?
Logarithmic time. Problem size is repeatedly halved.
What does O(n) mean?
Linear time. Runtime increases proportionally with n.
What does O(n²) mean?
Quadratic time. Common with nested loops
What does O(n³) mean?
Cubic time. Often caused by triple nested loops
What does O(n log n) mean?
Log-linear time. Better than O(n²), worse than O(n).
What does O(2ⁿ) mean?
Exponential time. Growth becomes extremely large as n increases.
What is the complexity of Linear Search?
O(n) May need to examine every element.
What is the complexity of Binary Search?
O(log n) Half the remaining elements are discarded after every comparison.
Requirement for Binary Search?
The data must be sorted.
Complexity of Quick Sort (average)?
O(n log n)
Complexity of Quick Sort (worst case)?
O(n²)
Complexity of searching a balanced BST?
O(log n)
Complexity of searching a degenerate BST?
O(n)
Which complexity grows fastest?
O(2ⁿ)