Pre-requisites: Handshaking theorem. Pendant Vertices Let G be a graph, A vertex v of G is called a pendant vertex if and only if v… Read More
Category Archives: Tree
Given a Binary Tree, the task is to convert the given Binary Tree to the Symmetric Tree by adding the minimum number of nodes in… Read More
Given an array arr[] of size N, the task is to count the number of longest increasing subsequences present in the given array. Example: Input:… Read More
Given a positive integer K and a weighted undirected connected graph of N nodes and E edges as an array Edges[] of the type {u,… Read More
AVL Tree is a self-balancing Binary Search Tree (BST) where the difference between heights of left and right subtrees cannot be more than one for… Read More
Given a Binary Tree, the task is to find the sum of leaf nodes at every level of the given tree. Examples: Input: Output:0063012Explanation:Level 1:… Read More
Given a root of the Binary Tree and head of the Linked List, the task is to check if all the elements of the linked… Read More
Given root of the Binary Tree T and a linked list L, the task is to find the direction of path followed from root such… Read More
Given an undirected, connected tree with N nodes valued from 0 to N – 1 and an array edges[][2] represents the edges between two nodes,… Read More
Given the root node of an N-ary tree and an integer K, the task is to convert the given tree into adjacency list representation and… Read More
Given a Binary Search Tree consisting of N distinct nodes, the task is to flatten the given Binary Search Tree to convert the tree into… Read More
Given a group of N people, each having a unique ID value from 0 to (N – 1) and an array arr[] of M elements… Read More
Given a Binary Search Tree, the task is to create a wave array from the given Binary Search Tree. An array arr[0..n-1] is called a… Read More
Given two arrays arr1[] and arr2[] of pairs of the form {ID, value} of size N and M respectively and an integer target, the task… Read More
Given a Generic Tree consisting of N nodes valued from 0 to (N – 1) where P[i]th in the array P[] denotes ith nodes parent(1-based… Read More