OUTPUT:
C:\j2sdk1.4.2_02\bin>java avl_main
AVL Tree
Enter your choice
Enter a data
2
Want to continue press 1
1
Enter a data
1
The tree before rotation
1 bf:0
2 bf:1
Want to continue press 1
1
Enter a data
4
The tree before rotation
1 bf:0
2 bf:0
4 bf:0
Want to continue press 1
1
Enter a data
5
The tree before rotation
1 bf:0
2 bf:-1
4 bf:-1
5 bf:0
Want to continue press 1
1
Enter a data
9
The tree before rotation
1 bf:0
2 bf:-1
4 bf:-2
5 bf:-1
9 bf:0
right-right rotaion
1 bf:0
2 bf:-1
4 bf:0
5 bf:0
9 bf:0
Want to continue press 1
1
Enter a data
3
The tree before rotation
1 bf:0
2 bf:-2
3 bf:0
4 bf:1
5 bf:0
9 bf:0
right-left rotation
1 bf:0
2 bf:0
3 bf:0
4 bf:0
Want to continue press 1
1
Enter a data
6
The tree before rotation
1 bf:0
2 bf:-1
3 bf:0
4 bf:-1
6 bf:0
Want to continue press 1
1
Enter a data
7
The tree before rotation
1 bf:0
2 bf:-1
3 bf:0
4 bf:-2
6 bf:-1
7 bf:0
right-right rotaion
1 bf:0
2 bf:-1
4 bf:0
6 bf:0
7 bf:0
3 bf:0
4 bf:0
No comments:
Post a Comment