Basic Tree Concept: Defining ancestors
F, C, A
are ancestors of H
cause there exists a path from root A
to node H
and nodes F, C, A
appear in the path. node H
is called descendant
of nodes F, C and A
.
E is not an ancestor of H. It's an uncle because it's a sibling of F, which is the parent of H.
F,C,A are ancestors of H. That's true.
G is not relevant to H at all.
Tree structure relationship notation can be found here (according to Wikipedia)
- A node's "parent" is a node one step higher in the hierarchy (i.e. closer to the root node) and lying on the same branch.
- "Sibling" ("brother" or "sister") nodes share the same parent node.
- A node's "uncles" are siblings of that node's parent.
- A node that is connected to all lower-level nodes is called an "ancestor". The connected lower-level nodes are "descendants" of the ancestor node.