Data Structures & AlgorithmsModerateProduct-company placement
What is the minimum number of edges m such that EVERY simple undirected graph with 10 vertices and m edges is guaranteed to be connected?
- A. 9
- B. 36
- C. 23
- D. 37
Correct answer: D. 37
A disconnected graph can have at most C(9, 2) = 36 edges (K_9 plus an isolated vertex), so 37 edges force connectivity. 9 edges are enough to connect, but they do not guarantee it.
Practise more Trees, Graphs, Recursion and Dynamic Programming questionsTrees, Graphs, Recursion and Dynamic Programming: notes and key points
More Trees, Graphs, Recursion and Dynamic Programming questions
- How many calls of g (including the first) are made when g(6) is evaluated, and what value is returned? c int g(int n) { if (n <= 2) return…
- For the string CHARACTERS, what are the lengths of the longest palindromic SUBSTRING and the longest palindromic SUBSEQUENCE?
- What is the minimum number of edges that must be deleted from the undirected graph with edges A–B, A–C, A–D, A–E, B–D, B–F, C–E, C–F, D–E…
- Dijkstra's algorithm runs from A on the directed graph A→B (14), A→F (2), C→A (12), C→E (7), C→F (2), D→B (7), D→C (5), D→E (3), E→F (6)…
- All suffixes of the string 'abcab' are inserted into a character trie (a suffix trie). How many nodes does it have, including the root?
- Six sorted files have 27, 35, 38, 45, 52, 54 records. Merging two files of sizes a and b costs a + b. What is the minimum total cost to…