Sie sind auf Seite 1von 2

Construct The Binary Tree from Preorder and

Inorder Sequence
Every binary tree has a unique pair of preorder /
inorder sequences.

Give preorder and inorder sequence as follows.


preorder sequence A B C D E F G H I
Inorder sequence B C A E D G H F I

Use the preorder sequence to find the root


Use the inorder sequence to find the nodes in
left and right subtrees

Prof. Gayathri. P, SCSE, VIT University

Construct The Binary Tree from Preorder and


Inorder Sequence
A

A
EDGHFI

B C

D
C

G
B

D, E, F, G, H, I

C
Prof. Gayathri. P, SCSE, VIT University

Das könnte Ihnen auch gefallen