Professional Documents
Culture Documents
Tree Datastructures
Tree Datastructures
Tree datastructures.
2
Contains Zero (or) more nodes
Node
3
Indegree, outdegree,
degree of a node: number of branches
root node, child, siblings, parent, leaf, internal nodes, external nodes,
level: distance of a node from the root
Height: maximum level of any leaf node
4
Zero or two sub trees
An empty tree
5
6
Strictly binary tree: out degree 0 or 2
Complete binary tree: non leaf node exactly
Has exactly 2 children
Skewed tree
7
Insertion, deletion
Traversal
Searching
Copying
8
Visiting each node in a tree in systamatic manner.
9
Preorder: A B D H E C F G I J
Inorder : D H B E A F C I G J
Postorder: H D E B F I J G C A
10
11
12
Preorder: AB DH EC F G I J
Inorder : D HB EAF C I G J
13
14
15
16
Preorder: AB DG C EH I F
Inorder : DGBAHEICF
Postorder: GDBHIEFCA
17
18
Preorder: AB C EI F J D G HK L
Inorder: E I C F J B G D K H LA
Postorder: IEJFCGKLHDBA
19
20
21
22
23
24
25
Symbol table construction
26
27