Flashcards · Big-O Notation · Free
Big-O Notation flashcards, generated for you.
Example Big-O Notation study cards to learn from right now — then generate a full set from your own notes (plus a practice quiz) and export to Quizlet or Anki. Free, no account needed.
Example Big-O Notation flashcards
What does Big-O notation measure?
How an algorithm's runtime or space requirements grow as input size (n) increases. It describes worst-case complexity by ignoring constants and lower-order terms.
Define O(1) time complexity with an example.
Constant time—execution time doesn't depend on input size. Example: accessing an array element by index, or checking if a number is even.
Define O(n) time complexity with an example.
Linear time—execution time grows proportionally with input size. Example: iterating through an array once, or linear search.
Define O(log n) time complexity with an example.
Logarithmic time—execution time grows slowly as input size increases. Example: binary search on a sorted array, or balanced BST lookup.
Define O(n²) time complexity and name a common example.
Quadratic time—execution time grows with the square of input size. Example: nested loops iterating through entire array (bubble sort, selection sort, naive string matching).
What is the key difference between O(n) and O(n log n)?
O(n log n) is slower than O(n) for large inputs. At n=1,000,000: O(n) ≈ 1M operations, O(n log n) ≈ 20M operations. Examples: O(n log n) includes merge sort and quick sort average case.
Why do interviewers ask about Big-O trade-offs?
To assess whether you optimize for the right metric (time vs. space). Example: merge sort is O(n log n) time but O(n) space; quick sort is O(n log n) average time with O(log n) space. Context matters.
How do you add complexities when operations happen sequentially?
Add them: O(n) + O(n²) = O(n²). Then simplify—keep the dominant term. Dominant = term that grows fastest as n increases.
How do you multiply complexities when operations are nested?
Multiply them: nested loop doing O(n) work inside O(n) iterations = O(n) × O(n) = O(n²). General rule: nested structures multiply their complexities.
What does it mean when an algorithm is 'space-time trade-off optimized'?
You sacrifice space (memory) to gain speed (time), or vice versa. Example: hash table is O(1) lookup (time optimized) but uses extra O(n) space. Choosing which to prioritize depends on system constraints.
Make your own Big-O Notation study set
Flashcards for related topics
Studying Big-O Notation to build with AI? MindloomHQ turns it into real skills — structured courses, agent projects, and certificates.
Explore MindloomHQ →