If a graph is a complete graph with n vertices, then total number of spanning trees is n(n-2) where n is the number of nodes in the graph. In complete graph, the task...

Share

What is Minimum Spanning Tree?
Given a connected and undirected graph, a spanning tree of that graph is a subgraph that is a tree and connects all the vertices togeth...

Share

Given a connected and undirected graph, a spanning tree of that graph is a subgraph that is a tree and connects all the vertices together. A single graph can have man...

Share

Reverse Delete algorithm is closely related to Kruskal’s algorithm. In Kruskal’s algorithm what we do is : Sort edges by increasing order of their weigh...

Share

Write a function that returns true if a given undirected graph is tree and false otherwise. For example, the following graph is a tree.
But the following graph is n...

Share

Given an undirected, connected and weighted graph, find Minimum Spanning Tree (MST) of the graph using Kruskal’s algorithm.
Input : Graph as an array of ed...

Share

Given the number of vertices and the degree of each vertex where vertex numbers are 1, 2, 3,…n. The task is to identify whether it is a graph or a tree. It ma...

Share

Given a binary tree, print it vertically. The following example illustrates vertical order traversal.
1
/
2 3
/ /
...

Share

Given a Binary Tree, find the vertical sum of the nodes that are in the same vertical line. Print all sums through different vertical lines.
Examples:
1
/ ...

Share

Given a Binary Tree where every node has following structure.
struct node {
int key;
struct node *left,*right,*random;
}
The random pointer points to any ...

Share