Binary Trees and Multitrees Final Topic 2
Binary Trees and Multitrees Final Topic 2
Multiway Trees
What is a TREE?
What is a TREE?
Tree represents the nodes connected by
edges.
Height of a Node
The height of a node is the number of edges from the node
to the deepest leaf (ie. the longest path from the node to a
leaf node).
Depth of a Node
Forest
A collection of disjoint trees is called a forest.
Parent Node: The node which is a predecessor
of a node is called the parent node of that node.
{B} is the parent node of {D, E}.
data item
struct node
{
int data;
struct node *left;
struct node *right;
};
Tree Traversals (Inorder, Preorder and Postorder)