Tree
Practice Questions
Terminologies
Root |
A tree has only one root node. It is a special node which does not have a parent. The entire tree gets referenced through it. |
Parent node |
An immediate predecessor of a node is a parent node. |
Child node |
All immediate successors of a node are child nodes. |
Leaf |
The final node is called leaf. Final leaves don’t have children. |
Edge |
The connection between one node to another is an Edge. It is a line that connects two nodes or one node and a leaf. |
Height of a node |
The number of edges on the longest path between that node and a leaf is the height of the node. |
Depth of a node |
The number of edges from the root node to the node is the depth of a node. |
Path |
|