HACKER Q&A
📣 soygul

Why is the top node of a tree structure called root node instead of tip?


Why is the top node of a tree structure called root node instead of tip?


  👤 quickthrower2 Accepted Answer ✓
Intuitively I think it is because "root" means "origin" (e.g. tell me about your roots i.e. your family, or the root of all evil etc.), and the top node is where you start when navigating the tree (it would be the memory reference you have first because it is stored in a variable, and you need to traverse to get to other nodes).

Using a physical tree analogy I'd call it a trunk rather than a root (and ignore that a real tree has roots entirely because they are a tree in their own right!)


👤 lioeters
It's because the tree is upside-down, growing from the top (root) to the branches and leaves (the tips) below.