Given a tree with N nodes where node 1 is the root, the task is to solve the queries of form {u, k} and find… Read More
Category Archives: Tree
Given a perfect binary tree of height N and an array of length 2N which represents the values of leaf nodes from left to right.… Read More
Given a tree of N nodes numbered from 1 to N and N-1 edges, and an array V[] of length N denoting the value of… Read More
Given a tree with N nodes, an array A[] of size N denoting the value of each node and array edges [][] of size (N-1),… Read More
AVL Trees: AVL tree is a self-balancing binary search tree in which each node maintain an extra factor which is called balance factor whose value… Read More
Given a binary tree and an integer K, the task is to write a program to count the number of nodes such that the path… Read More
What is Segment Tree? A Segment Tree is a data structure that stores information about a range of elements in its nodes. It also allows… Read More
Given a binary tree and a node start that is initially infected. For every second, neighbours of an infected node get infected. The task is… Read More
Trie data structure is defined as a Tree based data structure that is used for storing some collection of strings and performing efficient search operations… Read More
A Data Structure organizes and stores data in a computer so that we can perform operations on the data more efficiently. There are many diverse… Read More
Given N tanks connected like a tree, the connections between them in an array Edge[][], and the capacity of each tank in the array cap[],… Read More
Given a Binary Tree (BT), convert it to a Doubly Linked List (DLL). The left and right pointers in nodes are to be used as… Read More
What is a Perfect Binary Tree? A perfect binary tree is a special type of binary tree in which all the leaf nodes are at… Read More
Given an integer N, the task is to generate a perfect binary tree with height N such that each node has a value that is… Read More
A 2-3-4 tree is a self-balancing tree. The number represents the number of children each node can have. Any internal node can have either two,… Read More