Computer Science, asked by sachinshiva635, 5 days ago

conversion of general tree into binary​

Attachments:

Answers

Answered by 221064
1

Answer:

Below are the steps for the conversion of Generic Tree to Binary Tree:

As per the rules mentioned above, the root node of general tree A is the root node of the binary tree.

Now the leftmost child node of the root node in the general tree is B and it is the leftmost child node of the binary tree.

Now as B has E as its leftmost child node, so it is its leftmost child node in the binary tree whereas it has C as its rightmost sibling node so it is its right child node in the binary tree.

Now C has F as its leftmost child node and D as its rightmost sibling node, so they are its left and right child node in the binary tree respectively.

Now D has I as its leftmost child node which is its left child node in the binary tree but doesn’t have any rightmost sibling node, so doesn’t have any right child in the binary tree.

Now for I, J is its rightmost sibling node and so it is its right child node in the binary tree.

Similarly, for J, K is its leftmost child node and thus it is its left child node in the binary tree.

Now for C, F is its leftmost child node, which has G as its rightmost sibling node, which has H as its just right sibling node and thus they form their left, right, and right child node respectively.

Similar questions