GeeksforGeeks » Algorithms
BFS ( INSERTION )
(1 post)-
Hi,
i looked at the source code and understand it very well located onhttp://geeksforgeeks.org/?p=2686
how can i insert the new nodes in the tree with such tree logic?
A
when A refers B, then B will go on A's level 1 since it's empty like this:
A
BNow if A refers C, then the matrix will look like this:
A
B CNow if A refers D, then D will go under B like this:
A
B C
D
Now if A also refers E, then E will go under C:A
B C
D E
Now if A refers F, then F will go under B:
A
B C
D F E
If A refers G, then G will go under C:A
B C
D F E GI badly need your help, please do answer me :-(
Reply
You must log in to post.