Download presentation

Presentation is loading. Please wait.

Published byCornelius Starnes Modified over 2 years ago

1

2
There are many variations of balanced and semi- balanced binary trees. One of them, which is due to the work of Gaston H. Gonnet published in 1983, is the Internal Path Reduction (IPR) tree. Its height is the same as the AVL tree, but produces a slightly more compact structure. The internal path (IP) is defined as the sum of the path lengths of all nodes measured from the root. On average, the IPR tree produces an internal path of about 10% smaller than the AVL one. In addition, the IPR tree has a tunable parameter that determines the acceptable level of imbalance. IPR Trees are with no doubt superior compared to AVL Trees

3
AVL vs. IPR Both are BSTs Both are HB(1) They do not tolerate imbalance and the tree is restored to a proper shape by predefined rotations. IPR rotations are geared towards reducing IP in the tree ( ( IP = Σpath length from Node i to root i=1 to n ) AVL has attracted much more attention in the literature but IPR is kinda forsaken

4
Y X a c More Nodes to The Left of X N c > N a Single right rotation b

5
N b > N a Y X b a Double right rotation b2b2 b1b1 c More Nodes to The Left of X

6
Before Rotation 2N c +IP c +2N b +IP b +N a +IP a +3 More Nodes to The Left of X (SRR) After Rotation N c +IP c +2N b +IP b +2N a +IP a +3 IP 1 > IP 2 N c > N a

7
More Nodes to The Left of X (DRR) Before Rotation After Rotation 2N c +IP c +3N b1 +IP b1 +3N b2 +IP b2 +N a +IP a +6 2N c +IP c +2N b1 +IP b1 +2N b2 +IP b2 +2N a +IP a +5 IP 1 > IP 2 N b > N a

8
More Nodes to The Right of X Single Left Rotation Y X a c N c > N a b

9
Double Right Rotation Y X b a b2b2 b1b1 c More Nodes to The Left of X N b > N a

10
11 17 20 1711

11
17 20 8 145 5 815 16 15 16

12
11 17 20 814 5 16 15

13
16 11 17 20 8 14 5 16 15

14
Summary of Worst Case Complexities Height Internal Path Length <=1.4402 log 2 n >=1.2793 nlog 2 n 1.0515 nlog 2 n AVLIPR

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google