- #1
evinda
Gold Member
MHB
- 3,836
- 0
Hello! (Wave)
Suppose that we have a binary tree and a specific level $l$.
I want to add in the tree, a node $e$, as a child of the leftmost node of the level $l$, if the latter hasn't two children. If the leftmost node of the level $l$ has two children, then we have to look for a leftmost node, with less than two children, at the next levels and $e$ will be the child of the first such node, that will be found.
How can we add a node in a tree? (Thinking)
Suppose that we have a binary tree and a specific level $l$.
I want to add in the tree, a node $e$, as a child of the leftmost node of the level $l$, if the latter hasn't two children. If the leftmost node of the level $l$ has two children, then we have to look for a leftmost node, with less than two children, at the next levels and $e$ will be the child of the first such node, that will be found.
How can we add a node in a tree? (Thinking)