# Binary Tree

Binary heap is used to implement Priority queue. It is an array object, visualized as an almost complete binary tree. Binary heap comes in two flavours Max-Heap Min-Heap A max-heap is an almost complete binary tree, where, value at each node is greater than the value of its children. Similarly, a min-heap is an almost complete binary tree where […]

One way to ask this question is: Given a Binary tree that represent a family hierarchy. A parent can have at most two children (at most one girl child and at most one boy child). A girl child (if present) is always represented as left child in the binary tree, and a boy child (if present) […]

This is video discussion of a typical interview problem to check if the given Binary tree is a complete Binary tree or not.

This is the video of a typical interview problem to Check if all leaf nodes in a Binary tree are at the same level.

Given a binary tree write a function to check if all leaf nodes of the tree are at the same level. For example, In all the below trees, the leaf nodes are at same level: But in the below tree the leaf nodes are not at the same level: A A A / \ / […]

A Complete Binary Tree is a Binary Tree where each level is completely filled. For example, all the trees below are complete Binary trees Height=1 Height=2 Height=3 ——– ——– ——– A A A / \ / \ B C B C / \ / \ D E F G And the trees below are not […]

Glasses are arranged in the form of triangle (on top of each other) as shown below: 1 2 3 4 5 6 7 8 9 10 ……………….. …………………. Liquid is poured into 1st glass (Glass no. 1). When it is full, then extra liquid will flow into the glasses 2 and 3 in equal quantities. […]

Given a Binary tree, Write code to print all the boundary nodes in counter clockwise order. For example, for the below binary tree, The output should be: A, B, D, H, I, F, G, C, A . Boundary Nodes are traversed in anti-clockwise order.

Given a Binary Tree with n Nodes (you may arrange these nodes any way you want to). How many NULL pointers will be there ? You want options also :).. here are the options A) n B) n+1 C) n-1 D) None

Given a pointer to the root node of the tree, write code to find if it is an Almost Complete Binary Tree or not? A Binary Tree of depth d is Almost Complete iff: The tree is Complete Binary Tree (All nodes) till level (d-1). At level d, (i.e the last level), if a Node […]