in reply to How do I create a binary tree ?
Otherwise, everything important is done in the insert subroutine and it seems to be it is pretty much straight forward: if the value of the current node is larger than the value to be inserted, go down into the left subtree (by calling recursively insert on it); if it is larger, go down into the right subtree (also calling insert recursively); if it is equal, it is a duplicate, just ignore it; if the node is not defined, then create it, you're at the right place.
What is it that you don't understand?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How do I create a binary tree ?
by mr_mischief (Monsignor) on Dec 07, 2015 at 20:26 UTC | |
|
Re^2: How do I create a binary tree ?
by punitpawar (Sexton) on Dec 06, 2015 at 19:20 UTC | |
by choroba (Cardinal) on Dec 06, 2015 at 20:03 UTC | |
by Laurent_R (Canon) on Dec 06, 2015 at 22:20 UTC | |
by Anonymous Monk on Dec 07, 2015 at 14:26 UTC | |
by punitpawar (Sexton) on Dec 21, 2015 at 19:56 UTC | |
by Athanasius (Archbishop) on Dec 22, 2015 at 06:44 UTC |