Welcome To Tutorialspoint.dev
Officially launched 18th May 2019

# Height of a generic tree from parent array

We are given a tree of size n as array parent[0..n-1] where every index i in parent[] represents a node and the value at i represents the immediate parent of that nod...

# Maximum number of edges to be added to a tree so that it stays a Bipartite graph

A tree is always a Bipartite Graph as we can always break into two disjoint sets with alternate levels. In other words we always color it with two colors such that al...

# DFS for a n-ary tree (acyclic graph) represented as adjacency list

A tree consisting of n nodes is given, we need to print its DFS. Examples : Input : Edges of graph 1 2 1 3 2 4 3 5 Output : 1 2 4 3 5 ...

# Maximum product of two non-intersecting paths in a tree

Given an undirected connected tree with N nodes (and N-1 edges), we need to find two paths in this tree such that they are non-intersecting and the product of their l...

# Delete Edge to minimize subtree sum difference

Given an undirected tree whose each node is associated with a weight. We need to delete an edge in such a way that difference between sum of weight in one subtree to ...

# Roots of a tree which give minimum height

Given an undirected graph, which has tree characteristics. It is possible to choose any node as root, the task is to find those nodes only which minimize the height o...

# Check if two nodes are on same path in a tree

Given a tree (not necessarily a binary tree) and a number of queries such that every query takes two nodes of tree as parameters. For every query pair, find if two no...

# Applications of Minimum Spanning Tree Problem

Minimum Spanning Tree (MST) problem: Given connected graph G with positive edge weights, find a min weight set of edges that connects all of the vertices. MST is fund...

# Steiner Tree Problem

What is Steiner Tree? Given a graph and a subset of vertices in the graph, a steiner tree spans though the given subset. The Steiner Tree may contain some vertices wh...

# Prim’s Minimum Spanning Tree (MST) Greedy Algo-5

We have discussed&#xA0;Kruskal&#x2019;s algorithm for Minimum Spanning Tree. Like Kruskal&#x2019;s algorithm, Prim&#x2019;s algorithm is also a&#xA0;Greedy algorithm...