# Q1: Exercise for binary search trees ```CS2468 Tutorial 9
Question 1: Exercise for binary search trees.
a) Show the steps to insert two nodes with both keys as 7.
b) Show the steps to delete the node with key=8 (after inserting two nodes with
key=7).
1
3
2
8
6
9
5
Question 2. (a) Show the steps to delete the node with key=30 from the AVL tree.
(b) Show the steps to insert a node with key=6 (without deleting key=30).
18
12
h=5
5
14
2
1
8
4
3
h=4
7
13
9
v
20
16
15
30
19
17
34
25
32
35
31
6
Question 3: For a binary tree, if we assume that for each node v, the heights of its two
children can differ by at most 2, what is the height of the tree?
Question 4. Suppose that a file contains six distinct letters and their number of
occurrences are as follows: (a, 8), (b, 18), (c, 28), (d, 36) (e, 68) and (f, 88).
(1) Construct the binary tree for Huffman code and give the code word for each of the
six letters (using hands).
(2) Try to use MyHeap.java given on week 8’s website and the above input to
construct the binary tree.
```