Data Structures & AlgorithmsVery hardGATE CS · Advanced
A directed graph on the vertices A–E has the arcs C→B, C→A, B→C, B→E, B→A, D→E, E→B, E→A, A→C, A→B, A→D. Every vertex has equal in-degree and out-degree and the graph is strongly connected. How many distinct Eulerian circuits does it have, where two circuits are the same if one is a cyclic rotation of the other?
- A. 32
- B. 8
- C. 4
- D. 40
Correct answer: A. 32
BEST theorem: ec = t(G) * product over v of (outdeg(v) - 1)!, with t(G) = 8 spanning arborescences (from a Laplacian cofactor) and the factorial product = 4, giving 32; an enumeration of all circuits confirms this.
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
- Every node of a binary tree has either 0 or 2 children. Its preorder traversal is W S M Q R P K Z T and its postorder traversal is Q R M K…
- A graph has the vertices A–G and the edges A–B, A–C, A–D, B–D, B–F, B–G, C–D, C–F, C–G, D–F, E–F. In how many ways can the vertices be…
- Floyd-Warshall is run on a directed graph with vertices 1-6 and arcs (weights): 1→2 (9), 1→3 (8), 1→4 (8), 1→5 (1), 2→5 (3), 2→6 (8), 3→1…
- A flow network has source S = A and sink T = G (vertices A–G) with arcs and capacities: A→D (1), A→E (6), A→G (6), B→C (2), B→E (5), C→F…
- How many structurally different binary search trees can be built on the keys 1, 2, ..., 8 (all distinct shapes, one per key set) whose…
- A rooted tree has the vertices A–M with root A, given by parents: A is the parent of B, B is the parent of C, B is the parent of D, B is…