In the data structure, General tree is a tree in which each node can have either zero or many child nodes. It can not be empty. In general tree, there is no limitation on the degree of a node. The topmost node of a general tree is called the root node. There are many subtrees in a general tree. The subtree of a general tree is unordered because the nodes of the general tree can not be ordered according to specific criteria. In a general tree, each node has in-degree(number of parent nodes) one and maximum out-degree(number of child nodes) n.
A binary tree is the specialized version of the General tree. A binary tree is a tree in which each node can have at most two nodes. In a binary tree, there is a limitation on the degree of a node because the nodes in a binary tree can’t have more than two child node(or degree two). The topmost node of a binary tree is called root node and there are mainly two subtrees one is left-subtree and another is right-subtree. Unlike the general tree, the binary tree can be empty. Unlike the general tree, the subtree of a binary tree is ordered because the nodes of a binary tree can be ordered according to specific criteria.
Difference between General tree and Binary tree
|General tree||Binary tree|
|General tree is a tree in which each node can have many children or nodes.||Whereas in binary tree, each node can have at most two nodes.|
|The subtree of a general tree do not hold the ordered property.||While the subtree of binary tree hold the ordered property.|
|In data structure, a general tree can not be empty.||While it can be empty.|
|In general tree, a node can have at most n(number of child nodes) nodes.||While in binary tree, a node can have at most 2(number of child nodes) nodes.|
|In general tree, there is no limitation on the degree of a node.||While in binary tree, there is limitation on the degree of a node because the nodes in a binary tree can’t have more than two child node.|
|In general tree, there is either zero subtree or many subtree.||While in binary tree, there are mainly two subtree: Left-subtree and Right-subtree.|
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Difference between Binary Tree and Binary Search Tree
- Difference between Binary tree and B-tree
- Complexity of different operations in Binary tree, Binary Search Tree and AVL tree
- Check if a binary tree is subtree of another binary tree using preorder traversal : Iterative
- Minimum swap required to convert binary tree to binary search tree
- Check whether a binary tree is a full binary tree or not | Iterative Approach
- Convert a Binary Tree to Threaded binary tree | Set 1 (Using Queue)
- Convert a Binary Tree to Threaded binary tree | Set 2 (Efficient)
- Convert a Binary Search Tree into a Skewed tree in increasing or decreasing order
- Check if max sum level of Binary tree divides tree into two equal sum halves
- Given level order traversal of a Binary Tree, check if the Tree is a Min-Heap
- Print Binary Tree levels in sorted order | Set 3 (Tree given as array)
- Convert an arbitrary Binary Tree to a tree that holds Children Sum Property
- Maximum sub-tree sum in a Binary Tree such that the sub-tree is also a BST
- Construct XOR tree by Given leaf nodes of Perfect Binary Tree
- Check whether a binary tree is a complete tree or not | Set 2 (Recursive Solution)
- Convert a given Binary tree to a tree that holds Logical AND property
- Convert a given Binary tree to a tree that holds Logical OR property
- Check if a given Binary Tree is height balanced like a Red-Black Tree
- Maximum difference between node and its ancestor in Binary Tree
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.
Improved By : MKS075