Data Structures & AlgorithmsVery hardCodeforces Div 2 · ICPC regional
Undirected weighted graph on vertices A, B, C, D, E with edges A–B (2), A–C (3), A–D (3), B–D (3), C–E (3), D–E (2). An edge is CRITICAL if it appears in every minimum spanning tree. How many critical edges does this graph have?
- A. 4
- B. 6
- C. 2
- D. 5
Correct answer: C. 2
There are 5 minimum spanning trees; the edges common to all of them number 2. Counting edges that appear in some tree is a different quantity.
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
- Array A = [5, 3, 5, 3, 2, 2, 4, 4]. An increasing subsequence is chosen by INDEX positions i1 < i2 < … with A[i1] < A[i2] < … (strictly…
- Undirected weighted graph on vertices A, B, C, D, E; its edges, in this listed order, are: A–C (1), B–C (8), B–D (5), D–E (6), C–E (7)…
- Consider the recursive function def f(n): if n < 3: return 1; return f(n-1) + f(n-3). Evaluate f(9) and count every invocation of f…
- A binary tree with distinct letters has preorder DAEFCB and inorder EADCFB. What is its postorder traversal (left, right, root), written…
- Connected undirected graph on vertices A, B, C, D, E, F with edges A–C (1), A–D (1), A–E (1), A–F (1), B–D (1), E–F (1) (weights ignored)…
- 5 × 4 grid, rows top to bottom ('#' = blocked, '.' = open): ..#. / ...# / ...# / ..#. / ..... Count the paths from top-left to…