T2 v2

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

AVL

Develop AVL Tree which contains the following functions:


- Add and remove data into/from AVL Tree
- Show data in AVL Tree using Pre-order Traversal
command description
a 10 Add 10 into AVL Tree
d 20 remove 20 from AVL Tree
p Show data in AVL Tree using Pre-order Traversal
x Exit

Example
Input Output
a 10 10 20
a 20 20 10 30
p 20 10 30 40
a 30 20 10 40 30 50
p 40 20 10 30 50 60
a 40 40 20 10 30 60 50 70
p 50 20 10 30 60 70
a 50 60 20 10 30 70
p 20 10 70 30
a 60
p
a 70
p
d 40
p
d 50
p
d 60
p
x

You might also like