## Difference between graph and tree

Graph : A graph is collection of two sets V and E where V is a finite non-empty set of vertices and E is a… Read More »

## Some Basic Theorems on Trees

Tree:- A connected graph without any circuit is called a Tree. In other words, a tree is an undirected graph G that satisfies any of… Read More »

## Perform the given queries on the rooted tree

Given a rooted tree and not necessarily binary. The tree contains N nodes, labeled 1 to N. You are given the tree in the form… Read More »

## Nutanix Interview Experience (On-Campus 2018)

The entire process consisted of 5 rounds: 1 online coding, 1 debugging, 2 Technical and 1 HR/System Design Round. The minimum criteria for the online… Read More »

## Queries for DFS of a subtree in a tree

Given a tree of N nodes and N-1 edges. The task is to print the DFS of the subtree of a given node for multiple… Read More »

## Check if two trees have same structure

Given two binary trees. The task is to write a program to check if the two trees are identical in structure. In the above figure… Read More »

## Flatten a binary tree into linked list | Set-2

Given a binary tree, flatten it into a linked list. After flattening, the left of each node should point to NULL and right should contain… Read More »

## Check if a binary tree is sorted level-wise or not

Given a binary tree. The task is to check if the binary tree is sorted level-wise or not. A binary tree is level sorted if… Read More »

## Convert a Binary Tree such that every node stores the sum of all nodes in its right subtree

Given a binary tree, change the value in each node to sum of all the values in the nodes in the right subtree including its… Read More »

## Combinatorics on ordered trees

An ordered tree is an oriented tree in which the children of a node are somehow ordered. It is a rooted tree in which an… Read More »

## Longest Palindromic Substring using Palindromic Tree | Set 3

Given a string, find the longest substring which is palindrome. For example, if the given string is “forgeeksskeegfor”, the output should be “geeksskeeg”. Prerequisite :… Read More »

## Vertical width of Binary tree | Set 1

Given a binary tree, find the vertical width of the binary tree. The width of a binary tree is the number of vertical paths. In… Read More »

## TreeMap ceilingEntry() and ceilingKey() methods in Java

There are two variants of ceilingEntry() in Java.util.TreeMap, both are discussed in this article. 1. ceilingEntry(K Key) : It is used to return a key-value… Read More »

## Convert a Binary Tree into its Mirror Tree

Mirror of a Tree: Mirror of a Binary Tree T is another Binary Tree M(T) with left and right children of all non-leaf nodes interchanged.… Read More »

## Write a program to Delete a Tree

To delete a tree we must traverse all the nodes of the tree and delete them one by one. So which traversal we should use… Read More »