answersLogoWhite

0


Best Answer

The process of converting the general tree to a binary tree is as follows:

* use the root of the general tree as the root of the binary tree

* determine the first child of the root. This is the leftmost node in the

general tree at the next level

* insert this node. The child reference of the parent node refers to this

node

* continue finding the first child of each parent node and insert it below

the parent node with the child reference of the parent to this node.

* when no more first children exist in the path just used, move back to the

parent of the last node entered and repeat the above process. In other

words, determine the first sibling of the last node entered.

* complete the tree for all nodes. In order to locate where the node fits

you must search for the first child at that level and then follow the

sibling references to a nil where the next sibling can be inserted. The

children of any sibling node can be inserted by locating the parent and then

inserting the first child. Then the above process is repeated.

User Avatar

Wiki User

15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: General tree to binary tree conversion?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Implementation of general tree?

Binary tree is a tree where each node has one or two children.While in case of general tree, a node can have more than two children.A binary tree can be empty, whereas the general tree cannot be empty


Why you represent the general trees as binary trees?

General trees are not binary trees. It is the other way around, however, see the last paragraph for a different answer - explanation first... A binary tree is one with two possible child nodes, a left node and a right node, either of which might be not present. This particular representation implies a certain order between the node and its children, and if you walk the tree from bottom left to bottom right, you will traverse the nodes in order. A general tree is one with any number of possible child nodes, including no child nodes, so a binary tree is an example of a general tree, while a general tree is a generalization of a binary tree. However, in the general tree, the meaning of the child nodes might not have any specific ordering, like those in a binary tree, unless the general tree has other information contained in the node about order, because the concept of left and right has no implied meaning when there are more than two children. But, as promised, if the general tree has order, it is always possible to represent the general tree as a binary tree - there will just be more nodes, but they will only contain zero, one, or two children, and they will have an implied order.


What is the difference between binary tree and tree data structure?

binary tree is a specific tree data structure where each node can have at most 2 children nodes. In a general Tree data structure nodes can have infinite children nodes.


How many types of binary tree?

A binary tree is type of tree with finite number of elements and is divided into three main parts. the first part is called root of the tree and itself binary tree which exists towards left and right of the tree. There are a no. of binary trees and these are as follows : 1) rooted binary tree 2) full binary tree 3) perfect binary tree 4) complete binary tree 5) balanced binary tree 6) rooted complete binary tree


Are binary tree and binary tree same?

Yes.


Copy of binary tree?

Is another binary tree.


When converting binary tree into extended binary tree all the original nodes in binary tree are?

will remain same


Does binary tree and binary search tree same?

no they are not same


There are 8 15 13 14 nodes were there in 4 different trees Which of them could have formed a full binary tree?

In general: There are 2n-1 nodes in a full binary tree. By the method of elimination: Full binary trees contain odd number of nodes. So there cannot be full binary trees with 8 or 14 nodes, so rejected. With 13 nodes you can form a complete binary tree but not a full binary tree. So the correct answer is 15. niraj


What are the application of binary tree in computer science?

What are the applications of Binary Tree.


What is meant by left skewed binary tree?

a binary tree with only left sub trees is called as left skewed binary tree


What is conversion of 125.25 into binary?

1111101.01