Data Structures & AlgorithmsVery hardGATE CS · ICPC regional

How many spanning trees does the complete bipartite graph K_{4,4} have, with 4 vertices on one side and 4 on the other?

  1. A. 11440
  2. B. 16
  3. C. 128
  4. D. 4096

Correct answer: D. 4096

A formula for the spanning trees of K_{m,n} is m^(n−1) · n^(m−1), which can be checked on K_{2,2} (a 4-cycle, 4 spanning trees). Counting edge subsets of size n − 1 without the connectivity test, or using the total edge count, does not give the answer.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic