answersLogoWhite

0

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

Still curious? Ask our experts.

Chat with our AI personalities

CoachCoach
Success isn't just about winning—it's about vision, patience, and playing the long game.
Chat with Coach
JudyJudy
Simplicity is my specialty.
Chat with Judy
MaxineMaxine
I respect you enough to keep it real.
Chat with Maxine

Add your answer:

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