Data Structures & AlgorithmsModerateTCS NQT · graph theory
Problem: Which characterisation of bipartite graphs is correct?
- A. A graph is bipartite if and only if it has no edges
- B. A graph is bipartite if and only if it is a tree
- C. A graph is bipartite if and only if it contains no odd cycle
- D. A graph is bipartite if and only if its degrees are all equal
Correct answer: C. A graph is bipartite if and only if it contains no odd cycle
Two-colouring a connected graph works exactly when every cycle has even length.
More Coding Interview Problems questions
- Problem: What does the Erdos-Szekeres theorem state?
- Problem: What does Dilworth's theorem say about a finite partially ordered set?
- Problem: What is the time complexity of range-assign and range-sum queries with a lazy segment tree?
- Problem: What does the two-heap technique compute in a data stream?
- Problem: Which structure gives the best rational approximations to a real number in a tree form?
- Problem: Which algorithm computes the longest path in a weighted directed acyclic graph in O(V + E)?