## set vs unordered_set in C++ STL

Pre-requisite : set in C++, unordered_set in C++ Differences : | set | unordered_set ——————————————————— Ordering | increasing order | no ordering | (by default)… Read More »

## Red Black Tree vs AVL Tree

In this post we will compare Red Black Tree and AVL Tree. Red Black Tree: Properties: Self-Balancing is provided by painting each node with one… Read More »

## Print BST keys in given Range | O(1) Space

Given two values n1 and n2 (where n1 < n2) and a root pointer to a Binary Search Tree. Print all the keys of tree… Read More »

## BST to a Tree with sum of all smaller keys

Given a Binary Search Tree(BST), convert it to a Binary Tree such that every key of the original BST is changed to key plus sum… Read More »

## Reverse a path in BST using queue

Given a binary search tree and a key, your task to reverse path of the binary tree. Prerequisite : Reverse path of Binary tree Examples… Read More »

## Euler Tour | Subtree Sum using Segment Tree

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 »

## K’th Largest element in BST using constant extra space

Given a binary search tree, task is to find Kth largest element in the binary search tree. Input : k = 3 Root of following… Read More »

## Special two digit numbers in a Binary Search Tree

Given a Binary Search Trees, task is to count the number of nodes which are having special two digit numbers. Prerequisite : Special Two Digit… 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 »

## Rank of an element in a stream

Given a stream of integers, lookup the rank of a given integer x. Rank of an integer in stream is “Total number of elements less… 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 »

## Simple Recursive solution to check whether BST contains dead end

Given a Binary Search Tree that contains positive integer values greater than 0. The task is to check whether the BST contains a dead end… Read More »

## Find a pair with given sum in BST

Given a BST and a sum, find if there is a pair with given sum. Input : sum = 28 Root of below tree Output… Read More »

## Microsoft Interview Experience | Set 159 (On campus)

Round 1: The first round consisted of two coding questions to be solved in 1 hr – Given a binary tree, print the boundary of… Read More »

## Iterative searching in Binary Search Tree

Given a binary search tree and a key. Check the given key exist in BST or not without recursion. Recommended: Please try your approach on… Read More »