Difference between General tree and Binary tree

https://www.geeksforgeeks.org/difference-between-general-tree-and-binary-tree/

Difficulty Level :?Easy

Last Updated :?19 Feb, 2020

General Tree:

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.

Binary Tree:

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 treeBinary 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.

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the?DSA Self Paced Course?at a student-friendly price and become industry ready.? To complete your preparation from learning a language to DS Algo and many more,? please refer?Complete Interview Preparation Course.

In case you wish to attend?live classes?with experts, please refer?DSA Live Classes for Working Professionals?and?Competitive Programming Live for Students.

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容