## In a Binary Tree, Check if two nodes are Cousins

Objective: Given a binary tree and two nodes, Check if they are cousins Input: A binary tree and two nodes Cousin Nodes: Cousin nodes are the nodes who are at the same level in...

@tutorialhorizon

Objective: Given a binary tree and two nodes, Check if they are cousins Input: A binary tree and two nodes Cousin Nodes: Cousin nodes are the nodes who are at the same level in...

Objective: Given Two binary Search Trees, Check if both are identical. Input: Two binary Search Trees Approach:

Objective: Given a binary tree, Print paths from root to all leaf nodes Input: A binary tree Example: Approach:

Objective: Given a String, print all the permutations of it. Input: A String Output: Print all the permutations of a string Example: Input : abc Output: abc acb bac bca cba cab Approach:

Objective: Given a binary Tree and two levels, Print all the nodes between those. Input: A Binary Tree and two levels. Output: Print all the nodes between given levels. Example:

Objective: Given a binary Tree, write an algorithm to find the maximum width. Note: Maximum width of a tree is nothing but the Max(nodes at each level). Input: A Binary Tree Output: Maximum width...

Objective: Given a binary Tree, Do Level Order Traversal in Zig Zag pattern OR Print in Spiral Input: A Binary Tree Output: Order Traversal in Zig Zag pattern OR Print in Spiral.

Objective: Given a Binary tree, find out whether its binary search tree or not. Input: A Binary Tree. Output: True or false based on whether tree is BST ot not. Approach: Method 1 :...

Objective: Given a Binary tree, Find the size of the tree. Note : Size of the tree is number of nodes in the tree Input: A Binary Tree. Output: Size of the tree. Example...

Objective: Given two binary trees, check if one binary tree is a subtree of another Input: Two binary trees Output: True or false based on whether one tree is subtree of another Example :...

Objective: Given a Binary tree (Not binary Search Tree ), Print a path from root to a given node. Input: A binary tree, a node x Output: Path from root to a given node...

Objective: Given a Binary Search tree, find the inorder successor of a node. What is Inorder Successor: Inorder successor of a node is the next node in the inorder traversal of the tree. For...

Algorithms – Inorder Successor in Binary Search Tree Using Parent link Objective: Given a Binary Search tree in which every node has a link to its parent, find the inorder successor of a node....

Algorithms – Inorder Successor in Binary Tree Objective: Given a Binary tree (Not binary Search Tree ), find the inorder successor of a node. What is Inorder Successor: Inorder successor of a node is...

Objective: Given a sorted array with unique elements, Create a binary search tree with minimal height. Why minimal height is important : We can do the linear scan to the array and make the...

%d bloggers like this: