Tree implementation? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Tree implementation?

How do I implement a tree? Including insertion and deletion. I've been googling it but I just couldn't find any example. Therefore I don't really understand how trees are built, by given pairs of connected node index.

1st Jan 2019, 10:45 AM
William Tseng
William Tseng - avatar
2 Answers
0
Gordie Then how about indexes: For example 5 2 (Left) 5 7 (Right) 2 1 (Left) 2 4 (Right) 7 6 (Left) 7 9 (Right)
1st Jan 2019, 3:02 PM
William Tseng
William Tseng - avatar
0
Gordie Just like given the root node, and the child node, and whether it is a left node or right node.
1st Jan 2019, 10:53 PM
William Tseng
William Tseng - avatar