[O1] Big-O review (3 pts) [00JN]

For each of the following, answer with the best (smallest) upper bound from this list: O(1), O(\log n), O(n), O(n \log n), O(n^2), O(2^n). Give a brief justification for each.

  1. Number of leaves in a depth-n balanced binary tree
  2. Depth of an n-node balanced binary tree
  3. Number of edges in an n-node tree
  4. Time needed to sort a list of n items using merge sort
  5. Number of distinct subsets of a set of n items
  6. Number of bits needed to represent the number n in binary
  7. Time needed to find the closest pair of points among n points in Euclidean space by simply listing all the pairs
  8. Time needed to insert n items into a binary heap
  9. Time needed to find the second largest number in a sorted list of n distinct numbers
  10. Time needed to find the second largest number in an unsorted list of n distinct numbers

Context

Algorithms problems [00JL]

Backlinks

Big-O is not about time! [00JS]