The Minimum Spanning Tree of a weighted undirected graph is a tree, such that sum of the weight of the edges is minimum. There can be many Spanning Tree's of a graph.
Now how do we find that out? We can use Prim's Algorithm. Our task is to set up lines in such a way that all the houses are connected and the cost of setting up the whole connection is minimum. The edge between the houses represent the cost of setting line between two houses.
We want to setup telephone lines between these houses. polynomial-time bounded algorithm for Minimum Vertex Cover.
Lowest common ancestor of a Binary Tree.Algo:- Print a m*n matrix in square wise.