Data Structures & AlgorithmsVery hardICPC regional · number theory
Problem: What is the Stern-Brocot tree's relevance to competitive programming?
- A. It sorts strings
- B. It computes shortest paths
- C. It enumerates all positive rationals in lowest terms exactly once
- D. It counts prime factors
Correct answer: C. It enumerates all positive rationals in lowest terms exactly once
Each positive reduced fraction appears exactly once as a node of the Stern-Brocot tree.
More Coding Interview Problems questions
- Problem: Which algorithm finds all integer points on the convex hull boundary of a set of points?
- Problem: What is the purpose of the 'sqrt decomposition' technique for an array?
- Problem: Which statement about the 'Chinese remainder theorem' is correct for non-coprime moduli?
- Problem: What is the complexity of computing the Euler totient for all numbers up to n with a linear sieve?
- Problem: Which technique computes the sum of a function over all subsets of a set of size n in O(n 2^n)?
- Problem: What does the cross product of two 2D vectors (a, b) and (c, d) equal?