Pages

Monday, 3 October 2011

cs301 old Assignmnet Solution

Question 1:

Make an AVL tree for the following input.
79, 47, 76, 53, 75, 56, 90, 48, 63, 59
Show all the necessary rotations where possible



























Question 2:

Consider the following AVL tree.

 Show the tree after deleting the node 80.
 Show the AVL tree after deleting the node 50.
 Show the AVL tree after inserting the node 79.








































Question 3:
Given Letters A, B, C, D, E with following frequencies.

Frequency Table

character frequency Huffman Codes
A 20 10
B 11 1110
C 8 1111
D 12 110
E 49 0

A) Create a Huffman tree to determine the binary codes for each character.
B) Fill the codes into the table above.
c) Encode the following sequence ABCDE.


Answer: