Module 3
Module 3
deleted->rlink->llink = deleted->llink;
free(deleted);
}
}
TREES
K k
• For any nonempty binary tree, T, if is the number of leaf nodes and
the number of nodes of degree 2, then = + 1
Proof:
Let be the number of nodes of degree one and n the total number of
nodes.
Since all nodes in T are of degree at most two
n = + + ---------------------------1
• If we count the number of branches in a binary tree, every node except
the root has a branch leading into it.
• If B is the number of branches, then n = B+1