1. Binary Trees
a. Draw the result figure of a binary search tree by inserting the abbreviations of states OH, FL, PA, SD, MA, IL, HI, WI, IN, TX, AL, and CA into an empty tree in that input order, the comparison is using alphabetical order.
b. After the figure in a, draw it again by deleting the root node (Hint: keep the properties of binary search tree)
2. Red-black Tree
Draw the final figure in Red-black tree by inserting the abbreviations of states OH, FL, PA, SD, MA, IL, HI, WI, IN, TX, AL, and CA into an empty tree in that input order (the comparison is using alphabetical order). Describe those steps where red-black rules are against and what actions you have applied to make them correct.
3. Huffman Code
Construct the Huffman tree corresponding to character frequencies of O(4), P(6), F(8), R(14), C(16), and D(20), and what are the Huffman codes for those characters?
4. Hash Tables
Given an input in the order of {37, 25, 73, 49, 55, 67, 26, 95} and a hash function h(x)=x (mod 11).
a. Show the result of quadratic open addressing probing algorithm.
b. Show the resulting of open addressing hash table with second hash function h2(x)=5-(x mod 5).
5. Heap
How many calls of TricleDown (the method) must be made to Max-heapify the following array x? Show array x after each of the TricleDown call.
i | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
X[i] | 15 | 30 | 23 | 31 | 40 | 27 | 7 | 51 | 1 |