Tree
What is a tree?
- A tree is a data structure that represents hierarchical data
- The nodes in the tree have a 1:N parent-child relationship
- Every tree has a root node
- A root node is a point where the tree begins
- Leaves are outer boundary
Where are tree used?
- To manage file system in the operating system
- To implement indexing in databases
- In router algorithms
- In compilers
- In computer networking
Properties of trees
- Every node has exactly one tree, except the root node
- The root node has a zero node
- Tree spawns zero or more children
- The tree has a limit on children which is called degree of a tree
- Leaf nodes have no children
- One data item per node