Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.

Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.

Like this presentation? Why not share!

4,565 views

Published on

Analysis and design of algorithm

No Downloads

Total views

4,565

On SlideShare

0

From Embeds

0

Number of Embeds

2

Shares

0

Downloads

221

Comments

0

Likes

5

No embeds

No notes for slide

- 1. Presentation On : AVL TREESGroup Member:Chhatra Thapa (Sid:10935)Susat Maharjan (Sid:10954) 1
- 2. AVL TREE IS…• named after Adelson-Velskii and Landis• the first dynamically balanced trees to be propose• Binary search tree with balance condition in which the sub-trees of each node can differ by at most 1 in their height 2
- 3. DEFINITION OF A BALANCED TREE• Ensure the depth = O(log N)• Take O(log N) time for searching, insertion, and deletion• Every node must have left & right sub-trees of the same height• Goal: keep the height of a binary search tree O(log N). 3
- 4. AN AVL TREE HAS THE FOLLOWING PROPERTIES:• Sub-trees of each node can differ by at most 1 in their height• Every sub-trees is an AVL tree 4
- 5. AVL TREE? YES NO Each left sub-tree has Left sub-tree has height 3, height 1 greater than but right sub-tree has each right sub-tree height 1 5
- 6. INSERTION AND DELETIONS• It is performed as in binary search trees• If the balance is destroyed, rotation(s) is performed to correct balance• For insertions, one rotation is sufficient• For deletions, O(log n) rotations at most are needed 6
- 7. Single Rotation left sub-tree is one level move ① up a level and deeper than the right sub-tree ② down a level 7
- 8. Single rotation : Rotate right 8
- 9. Single rotation : Rotate left 9
- 10. Double RotationLeft sub-tree is two level Move ② up two levels anddeeper than the right sub-tree ③ down a level 10
- 11. Insertion Insert 6 Imbalance at 8 Perform rotation with 7 11
- 12. 12
- 13. Deletion Delete 4 Imbalance at 3 Perform rotation with 2Imbalance at 5Perform rotation with 8 13
- 14. 14
- 15. KEY POINTS• AVL tree remain balanced by applying rotations, therefore it guarantees O(log N) search time in a dynamic environment• Tree can be re-balanced in at most O(log N) time 15
- 16. THANK YOU 16

No public clipboards found for this slide

×
### Save the most important slides with Clipping

Clipping is a handy way to collect and organize the most important slides from a presentation. You can keep your great finds in clipboards organized around topics.

Be the first to comment