quartz/content/out/notes/big-o.md
2022-04-06 20:11:37 +12:00

22 lines
688 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: Big-O
draft: true
sr-due: 2022-06-01
sr-interval: 62
sr-ease: 271
---
tags: #review
---
# Big-O
>Big O means $f(n) = O(g(n))$ if there is some constant $A > 0$ such that for all sufficiently large n, $f(n) ≤ A × g(n).$
- Big O provides *upper bounds* only. (usually on worst case runtimes)
- sometimes cost will be much less
- does not take special cases into account
- upper bound
- $O$ says that $g(n)$ provides an upper bound for $f(n)$
- "Insertion sort is $O(n^2)$" -> the maximum number of basic operations in never more than some constanct times $n^2$
- if $f(n) =O(g(n))$ then the opposite is also true
- usually $f(n)$ is complex but $g(n)$ is very simple