## Print cousins of given node in a binary tree

Given a binary tree, print all cousins of a given node. Two nodes of binary tree are cousins of each other only if they have different parents but they have same level.

Coding made easy

Binary Trees

Given a binary tree, print all cousins of a given node. Two nodes of binary tree are cousins of each other only if they have different parents but they have same level.

Given a binary tree, determine if two given nodes are cousins of each other or not. Two nodes of binary tree are cousins of each other only if they have different parents but they have same level.

Given a binary tree, check if it is a complete binary tree or not.

Given a binary tree and a node in it, write an efficient algorithm to find its next node in same level as given node.

Given an binary tree, print top view of it. Assume, the left and right child of a node makes 45 degree angle with the parent.

Given an binary tree, print bottom view of it. Assume, the left and right child of a node makes 45 degree angle with the parent.

Given a binary tree, write an efficient algorithm to print left view of binary tree.

Given a perfect binary tree, write an efficient algorithm to print all nodes of it in specific order. We need to print nodes of every level in alternating left and right.

Given a binary tree, print its nodes level by level in reverse order. i.e. all nodes present at last level should be printed first followed by nodes of second-last level and so on.. All nodes for any level should be printed from left to right.

Given a binary tree, print its nodes level by level in spiral order. i.e. all nodes present at level 1 should be printed first from left to right, followed by nodes of level 2 right to left, followed by nodes of level 3 from left to right and so on.. In other words, odd levels …

Given a binary tree, print its nodes level by level. i.e. all nodes present at level 1 should be printed first followed by nodes of level 2 and so on.. All nodes for any level should be printed from left to right.

Given a binary tree, write an efficient algorithm to delete entire binary tree. The program should de-allocate every single node present in the tree, not just change reference of the root node to null. The idea is to traverse the tree in post-order fashion and delete left and right subtree of a …