2022Algorithm1Tutorial5
2022Algorithm1Tutorial5
1. Show that the maximum height of an n-node AVL tree is O(log n).
2. Show that the average depth of a node in an n-node binary search tree is O(log n).
3. (a) Do in-order and pre-order traversals define a binary tree uniquely? If yes, then write an
algorithm; otherwise provide counter-example.
(b) Do post-order and pre-order traversals define a binary tree uniquely? If yes, then write an
algorithm; otherwise provide counter-example.
(c) Do in-order and post-order traversals define a binary tree uniquely? If yes, then write an
algorithm; otherwise provide counter-example.
4. Design an algorithm to find the k-th smallest/largest algorithm in a binary search tree.