Data structures & algorithmsLesson 2 of 4 in the course Algorithm analysis and sorting

Big O Bounds: Definitions, Growth Rules, and Related Notation

5 flashcards · 5 quiz questions · 5 match pairs · 4 fill-in sentences · English

Lesson progress
0 / 5

Your progress is kept in this browser only.Sign up to save it

Summary

Big O notation describes an upper bound on how quickly a function grows. In computer science, it helps compare how an algorithm’s time or space requirements change as its input grows.

Big O belongs to the Bachmann–Landau family of notations. The letter OO comes from the German word Ordnung, meaning “order.” In algorithm analysis, an expression such as T(n)=O(n2)T(n)=O(n^2) says that the running time is bounded above by a constant multiple of n2n^2 for the input sizes under consideration.

All flashcards

What is Big O notation?
A notation expressing an upper bound on a function’s growth relative to a comparison function, often used to classify algorithm resource use.
What does the comparison function represent?
It gives the growth scale used to bound the function being studied, such as nn, n2n^2, or 2n2^n.
What is the implied constant?
The positive constant MM for which ∣f(x)∣≤Mg(x)|f(x)| \le Mg(x) on the stated domain. Its exact value is commonly left unspecified.
Why does the domain matter in Big O?
The inequality must hold on the stated domain. A bound may be valid for sufficiently large inputs but fail for some smaller inputs.
Does f=O(g)f=O(g) mean ff equals gg?
No. The equals sign is conventional shorthand for a bound; it does not state that the functions have equal values.

Quiz questions

  1. What does a statement that an algorithm's running time is O(g(n))O(g(n)) establish?Answer: Its running time is bounded above by a constant multiple of g(n)g(n) over the stated range.
  2. For f(n)=6n4−2n3+5f(n)=6n^4-2n^3+5 with n≥1n\ge1, what is its standard large-input Big O bound?Answer: O(n4)O(n^4)
  3. What does f(x)=O(g(x))f(x)=O(g(x)) as x→ax\to a mean when aa is finite?Answer: The bound holds in a neighborhood of aa, subject to the functions’ domains.
  4. Why is xsin⁡y=O(x)x\sin y=O(x) for x≥1x\ge1 and every real yy a uniform bound?Answer: One constant works for every allowed xx and yy because ∣sin⁡y∣≤1|\sin y|\le1.
  5. For positive functions, what does f=Θ(g)f=\Theta(g) mean?Answer: Each function is bounded above by a constant multiple of the other.

Based on the Wikipedia article Big O notation, licensed CC BY-SA 4.0. Adapted into a summary, flashcards and quizzes.

All Data structures & algorithms lessons