## 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 »

Quick Links for Tree

Quizzes |

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 »

Euler tour tree (ETT) is a method for representing a rooted tree as a number sequence. When traversing the tree using Depth for search(DFS), insert… Read More »

Given N pieces of chessboard all being ‘white’ and a number of queries Q. There are two types of queries : Update : Given indices… Read More »

Given a binary tree, print the level order traversal in such a way that first two levels are printed from left to right, next two… Read More »

Given a string of brackets, task is to find the number of pairs of brackets involved in a balanced sequence in a given range. Examples… Read More »

Given an element x, task is to find the value of its immediate smaller element. Example : Input : x = 30 (for above tree)… Read More »

Given an N-ary tree, find sum of all elements in it. Example : Input : Above tree Output : Sum is 536 Recommended : Please… Read More »

Given a binary tree, find the vertical width of the binary tree. Width of a binary tree is the number of vertical paths. Examples: Input… Read More »

Given an array of numbers of size N and Q queries. Each query or a range can be represented by L (LeftIndex) and R(RightIndex). Find… Read More »

Given a binary tree, task is to do reverse inorder traversal using Morris Traversal. Prerequisites : Morris Traversals Threaded Binary Trees In a binary tree… Read More »

Given a number N, and Q queries of two types 1 and 2. Task is to write a code for the given query where, in… Read More »

AA trees are the variation of the red-black trees, a form of binary search tree. AA trees use the concept of levels to aid in… Read More »

Consider a Binary Heap of size N. We need to find height of it. Examples: Input : N = 6 Output : 2 () /… Read More »

A Tree is a generalization of connected graph where it has N nodes that will have exactly N-1 edges, i.e one edge between every pair… Read More »

Given a root node to a tree, find the sum of all the leaf nodes which are at maximum depth from root node. Example: 1… Read More »