11/20/2016IT 2791 Is this an AVL tree?
11/20/2016IT
11/20/2016IT the worst case
11/20/2016IT 2794 Analysis BST Average Heights on n Random Keys Devroye and Reed,, SIAM J. Comput. ‘95 the worst case n nodes n
11/20/2016IT n= != probability??? 4 p 4 3 p 3 2 p 2 = 0
11/20/2016IT 2796 Forget about the probability 4 p = ?? 3 q = ?? (4+3)/2 = 3.5 Amortized Analysis p and q are the probabilities to have a BST of height 4 and 3, respectively. Amortized Analysis simplifies the average-case analysis by ignoring the probability.
11/20/2016IT 2797 Some data-structures are not suitable for Amortized Analysis E.g., AVL, BST. Why? Q: Given an n-node binary search tree, what is the time complexity of search m keys in the tree? in the worst case AVL : BST : 1. The worst case of AVL is already tightly bounded to a good behavior. 2. The worst case of BST is not acceptable and hence supporting information regarding the statistic properties of the data space should not be ignored. This is why:
11/20/2016IT 2798 Splay Trees: Splay out the data along the path of access A good data structure for Amortized Analysis In Splay Tress, although there does exist some bad operations, but there is no bad sequence of operations. Thus, we don’t have to worry about the probability of any particular bad operation, because it won’t inflame the cost in a sequence of bad operations.
11/20/2016IT 2799 Splay Trees: More dynamic Since there is bad operation and we do not allow such a bad operation to form a bad sequence of operations, the tree must be adjusted not only during its construction phase, but also during every the accessing operation. In that sense, the Splay tree is “more” dynamic than the AVL tree and the BST
11/20/2016IT Splay Trees: Strategy Move the referred node up to the root along the path by the following two rotations: 1) zig-zag and 2) zig-zig G P X BC D A zig-zag GP X BC D A
11/20/2016IT Splay Trees: Strategy G P X B C D A zig-zig G P X B C D A See Fig 49 – Fig 58 for an example of splaying nodes.