The tree data structure mimics mother nature's tree. It is generally non-linear but is not inter-connected (is not a network).

Key Concepts:

  • The most important concept is node
  • There is one root node (or starting node or top node)
  • Each node has zero or more child nodes (think of the pointers to those nodes as branches)
  • Many trees have a defined number of children (binary = 2, ternary = 3, ...)
  • Child nodes may be null
  • Nodes hold data (e.g., customers, employees, etc) -- for simplicity we are showing integer data (e.g., 50, 20, 10, ...) in the diagram
A Simple Tree
                 50
                  |
          --------+--------
          |               |
          20              70
     -----+-----      -----+
     |         |      |
     10       40      60
         -----+
         |
        30

+---jdk-11.0.2
|   +---bin
|   |   \---server
|   +---conf
|   |   +---management
|   |   \---security
|   |       \---policy
|   |           +---limited
|   |           \---unlimited
|   +---include
|   |   \---win32
|   |       \---bridge
|   +---jmods
|   \---lib
|       +---jfr
|       +---security
|       \---server

References