Data Structures & AlgorithmsVery hardICPC regional · graph theory
Problem: What is the maximum number of edges in a simple planar bipartite graph with V >= 3 vertices?
- A. 3V - 6
- B. V^2 / 4
- C. V - 1
- D. 2V - 4
Correct answer: D. 2V - 4
Bipartite planar graphs have no triangles, so Euler gives at most 2V - 4 edges, a stronger bound than the general 3V - 6.
More Coding Interview Problems questions
- Problem: An undirected graph has vertices 0–5 and edges 0-1, 1-2, 2-0, 2-3, 3-4, 4-5, 5-3. How many edges are bridges (removal increases…
- Problem: Vertices 1–5 of a directed graph have arcs 1→2, 2→3, 3→1, 3→4, 4→5, 5→4, and 1→5. Using DFS from vertex 1, how many back edges…
- Problem: A tree with 6 nodes is given by parent array p = [−1, 0, 0, 2, 2, 4] for nodes 0–5 (root 0). What is the number of nodes whose…
- Problem: The string "xyzzyxzz" is considered. How many of its substrings of length 3 are palindromes (counted by index)?
- Problem: Among the strings "abc", "bca", "cab", "acb", "bac", "cba", how many distinct pairs (x, y) with x ≠ y are rotations of each other…
- Problem: Find the length of the longest substring of "aaabbbbcccd" that contains at most two distinct letters.