Trees grow downwards in computer science, and a root node is at the very top. The root of this tree is
/photos references to two other nodes:
/wedding are children or child nodes of
/photos is a parent node because it has child nodes.
/wedding share the same parent node, which makes them siblings.
Note that the
/safari node is child (to
/photos) and parent (to
giraffe.jpg). It’s extremely common to have nodes act as both parent and child to different nodes within a tree.
When a node has no children, we refer to it as a leaf node.
These terms: root, leaf, child, sibling, and parent give us a precise way to communicate the relationships between nodes.
What are the four leaf nodes in this diagram?
What node has no parent?
What is the sibling node to