Given an n-ary tree, the task is to check whether the given tree is binary or not.
Input: A / \ B C / \ \ D E F Output: Yes Input: A / | \ B C D \ F Output: No
Approach: Every node in a binary tree can have at most 2 children. So, for every node of the given tree, count the number of children and if for any node the count exceeds 2 then print No else print Yes.
Below is the implementation of the above approach:
- Check whether a binary tree is a full binary tree or not | Iterative Approach
- Given level order traversal of a Binary Tree, check if the Tree is a Min-Heap
- Check whether a binary tree is a complete tree or not | Set 2 (Recursive Solution)
- Check if a given Binary Tree is height balanced like a Red-Black Tree
- Check if the given binary tree has a sub-tree with equal no of 1's and 0's | Set 2
- Check if a binary tree is subtree of another binary tree | Set 1
- Check whether a binary tree is a full binary tree or not
- Check whether a given binary tree is skewed binary tree or not?
- Check if a binary tree is subtree of another binary tree | Set 2
- Complexity of different operations in Binary tree, Binary Search Tree and AVL tree
- Minimum swap required to convert binary tree to binary search tree
- Check whether a given binary tree is perfect or not
- Check if a given Binary Tree is SumTree
- A program to check if a binary tree is BST or not
- Check if a given Binary Tree is Heap
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.