Binary search tree
. A Overview
distinct from 1. The binary search tree is a binary tree of ordinary wherein: any node not larger than the right subtree of a node, which is not less than the left subtree of node
2. The binary search tree what traversal sequence is increasing? In order
. b1 Find
1. Find the BST with n nodes in the worst case time complexity of O (n)
2. Find 13, through the key node in a binary search tree above were:
16, 10, 11, 15, 13
. b2 inserted
after BST 1. insertion operation, treat the inserted element e to find a target, if the lookup fails, the node pointed to _HOT,: e is inserted after the father
b3 deleted.
1. When the node to be deleted in the BST in v is 2 degrees, the actual nodes are deleted:
v right subtree of a node in the last of the left branch
Analysis: i.e. v is in preorder direct successor
. c balance and equivalents
1. with n nodes, the height of the worst case time complexity is to find the BST h:
O (H)
2. with n nodes, referred to as the balanced height of the BST h binary search tree if it satisfies: H = (log2n) O
3. equivalent two balanced binary search tree have the same: the sequence preorder
d1.
1. In the AVL tree to the newly inserted node number of a node at most imbalances O (LGN)
2. The number of nodes imbalance immediately after deleting a node in the AVL tree at most O (. 1)
3. The following AVL tree root balance factor node is
-1
analysis: left subtree balance factor = height - height right subtree
4. AVL tree height of at least 3 comprises several nodes? 7
. d2 inserted
AVL tree node is inserted imbalance caused by the rotation adjustment rebalanced, now contains the node g, p, v subtree height
constant
analysis: In the AVL tree node unbalance correction caused by an imbalance insertion does not spread
. d3 remove
AVL tree deletion node imbalance caused by the rotation adjustment rebalanced, now contains the node g, p, v subtree highly
likely also possible to reduce a change
analysis: AVL tree nodes are removed from the correction initiator the imbalance there may be an imbalance spread
d4. remodeling
through the AVL tree __ 3 + 4 ___ reconstructed sequence preorder unchanged.
This chapter test
1. Which of the following is a binary search tree?
2. Include node {1,2,3,4} different binary search tree how many trees? 14
Analysis: Properties recursive binary tree list
3.
Find more binary search tree element 14, and the first three elements occur compared to 14: 11
4.
To remove the above binary search tree nodes 16, possible solution is:
the key exchange node 16 and node 15, the node 16 and the removal of the new order of 13 to 11 right sub-
analysis: 15 16 direct precursor in preorder
The height h and the number of binary search tree node n satisfies O = h (n)
6. The worst case time complexity of lookup thereon is O (n)
7. The If it is known that a balanced binary search tree, and h satisfy the relation n = O h (LGN)
8. the worst case time complexity of lookup thereon is O (LGN)
9. the
above binary search tree, the node 19 as an axis a zig after the operation the tree is obtained:
complexity in time 10. the AVL tree to find comprises n nodes is O (LGN)
11. the insertion of the time complexity is O (LGN)
12. the delete time complexity is O (LGN)
13.AVL tree node is inserted imbalance caused by the sub-tree rotation occurs by rotation adjustment to rebalance the constant height
14. the deletion of nodes it? Unchanged or decreased by 1
15. The
above AVL tree node 13 as just inserted imbalance, a weight-balancing algorithm learned class, the AVL tree to restore balance:
16. The above subtrees reconstruction 3 + 4, to give sub-tree: