Practice Discrete Math

Algorithms / Asymptotic Scenarios

Least You Need to Know: Mixed Big-O Scenarios

Mixed runtime questions combine scans, sorts, hash-table operations, and nested loops. Write each phase separately, then simplify to the dominant term.

The least you need to know

Key notation

A(n)+B(n) sum of phases
dominant term largest asymptotic contributor
average vs. worst case state the performance model

Tiny worked example

  • Copying `n` items is `Θ(n)`.
  • Sorting them with merge sort is `Θ(n log n)`.
  • A final scan is `Θ(n)`.
  • The total is `Θ(n log n)`.

Common mistakes

How to recognize this kind of problem

Next recommended lesson

Continue through this topic with Least You Need to Know: Backtracking as Search Over Partial Choices.

Least You Need to Know: Backtracking as Search Over Partial Choices

Related lessons

Keep going with nearby lessons in the same topic.

More ways to explore

Start practice