Tree
-
It is a collection of nodes.
-
There is a Parent-Child relation
for nodes.
-
It stores data by value
rather than position.
-
There is only one root. (starting
node)
-
Each node has several children.
(nonlinear structure)
-
Each node has unique
parent except the root.
-
There is no cycle.
-
It is defined recursively.
(subtree)
-
Leaf nodes have no children.
-
A path between a parent
node P and any node N in its subtree
is a sequence of nodes P
= X0 ,
X1, ..., Xk
= N, where k
is the length of the path.
-
The length of a path between the root and any node of the
tree is called the level of a node.
-
The depth of a tree is
the maximum level of any node in the tree.
Binary
Tree:
a tree with every node having
at most two children.
Complete
Tree:
Fill nodes level by level and from left to right.
Binary
Search Tree:
each node in left subtree < the nodes in right subtree