algorithm Trees Introduction


Trees are a sub-type of the more general node-edge graph data structure.

A binary search tree.

To be a tree, a graph must satisfy two requirements:

  • It is acyclic. It contains no cycles (or "loops").
  • It is connected. For any given node in the graph, every node is reachable. All nodes are reachable through one path in the graph.

The tree data structure is quite common within computer science. Trees are used to model many different algorithmic data structures, such as ordinary binary trees, red-black trees, B-trees, AB-trees, 23-trees, Heap, and tries.

it is common to refer to a Tree as a Rooted Tree by:

choosing 1 cell to be called `Root`
painting the `Root` at the top
creating lower layer for each cell in the graph depending on their distance from the root -the bigger the distance, the lower the cells (example above)

common symbol for trees: T