Data Structures & AlgorithmsModerateGATE CS · Product-company placement
The connected undirected graph with edges A–B, A–E, A–G, B–C, B–E, C–D, C–F, D–E, D–G, E–F, F–G, F–H must be walked so that every edge is traversed at least once, starting and ending at the same vertex. If repeated traversals are allowed, what is the minimum number of edges that must be added (duplicated) to make an Euler circuit possible, assuming every pair of odd vertices can be joined by a new edge?
- A. 6
- B. 2
- C. 3
- D. 4
Correct answer: C. 3
Euler circuit ⇔ connected and every degree even. There are 6 odd-degree vertices; each added edge fixes two of them, so 3 edges are needed.
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
- In the DAG with edges A→C, A→F, A→G, B→A, B→C, B→G, E→C, E→D, F→E, F→G, G→D, how many distinct directed paths are there from B to D, and…
- Five matrices have dimensions 10×15 , 15×3 , 3×5 , 5×15 , 15×15. What is the minimum number of scalar multiplications needed to compute…
- What is the minimum number of edges that must be deleted from the undirected graph with edges A–B, A–D, A–E, B–E, B–F, C–D, C–F, D–E, E–F…
- A 4-ary max-heap is stored in a 0-indexed array (children of i at 4i + 1 … 4i + 4): [51, 46, 36, 39, 2, 22, 35, 14, 13, 24]. After…
- How many subsets of {4, 7, 9, 10, 11, 13, 14} have sum exactly 31?
- Unit-time jobs (deadline, profit): J1 (3, 45), J2 (2, 47), J3 (1, 77), J4 (1, 75), J5 (1, 13), J6 (2, 37), J7 (3, 59). One job runs at a…