## Range query for Largest Sum Contiguous Subarray

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 | Set 1 (Introduction)

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 »

## Height of a complete binary tree (or Heap) with N nodes

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

## Euler Tour of Tree

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 »

## Sum of nodes at maximum depth of a Binary Tree

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 »

## Sum of Interval and Update with Number of Divisors

Given an array A of N integers. You have to answer two types of queries : 1. Update [l, r] – for every i in… Read More »

## Reverse tree path

Given a tree and a node data, your task to reverse the path till that particular Node. Examples: Input : 7 / \ 6 5… Read More »

## Binary Tree to Binary Search Tree Conversion using STL set

Given a Binary Tree, convert it to a Binary Search Tree. The conversion must be done in such a way that keeps the original structure… 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 »

## Get maximum left node in binary tree

Given a tree, the task is to find the maximum in an only left node of the binary tree. Examples: Input : 7 / \… Read More »

## Find sum of all nodes of the given perfect binary tree

Given a positive integer L which represents the number of levels in a perfect binary tree. Given that the leaf nodes in this perfect binary… Read More »

## Check if two trees are Mirror | Set 2

Given two Binary Trees, returns true if two trees are mirror of each other, else false. Mirror Tree : Previously discussed approach is here. Recommended:… Read More »

## Merge Sort Tree for Range Order Statistics

Given an array of n numbers, the task is to answer the following queries: kthSmallest(start, end, k) : Find the Kth smallest number in the… Read More »

## Dynamic Programming on Trees | Set 2

Given a tree with N nodes and N-1 edges, find out the maximum height of tree when any node in the tree is considered as… Read More »

## Check given array of size n can represent BST of n levels or not

Given an array of size n, the task is to find whether array can represent a BST with n levels. Since levels are n, we… Read More »