Data Structures & AlgorithmsModerateTCS NQT · graph theory
Problem: What is the maximum number of edges in a bipartite graph on n vertices with sides of size n/2?
- A. n^2 / 2
- B. n(n-1)/2
- C. n
- D. n^2 / 4
Correct answer: D. n^2 / 4
A complete bipartite graph K_{n/2,n/2} has (n/2)^2 = n^2/4 edges, the maximum possible.
More Coding Interview Problems questions
- Problem: Which problem is solved by Dijkstra's algorithm on a graph whose edge weights are small integers, using buckets (Dial's algorithm)?
- Problem: What is the best known approach for range-mode queries on a static array?
- Problem: Which concept describes the minimum number of comparisons to find the maximum of n numbers?
- Problem: What is the Ackermann-related complexity that appears in union-find analysis?
- Problem: What is the expected number of steps for a random walk on a path of length n starting at one end to reach the other end?
- Problem: Which algorithm computes a minimum-weight perfect matching in general (non-bipartite) graphs?