0% found this document useful (0 votes)
37 views7 pages

Test3 CSE205 - K18FR

This document contains 3 questions on data structures. The first asks to apply Huffman encoding to text. The second asks to perform operations on an AVL tree and show rotations. The third asks to use division hashing and double hashing to map keys

Uploaded by

Aryan Srivastava
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views7 pages

Test3 CSE205 - K18FR

This document contains 3 questions on data structures. The first asks to apply Huffman encoding to text. The second asks to perform operations on an AVL tree and show rotations. The third asks to use division hashing and double hashing to map keys

Uploaded by

Aryan Srivastava
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 7

CSE205: Data Structures & Algorithms

Test-3 (K18FR)

Roll No.:________________ Reg. No.:________________


Maximum Marks: 30 Time: 40 Min.
---------------------------------------------------------------------------------------------------------------------------------------------------
1. Apply the Huffman Encoding to draw the Huffman Code Tree for the following text and find the codes for the given characters:
truck in the traffic

t R i e f c

2. Given the Sequential Representation of the AVL Search Tree, perform the Insertion/Deletion according to the operation
mentioned in the table, show the rotation and fill the details in the table after the rotation:

Sequential Representation of the Given AVL Operation to be Rotation Sequential Representation of the AVL after the
Tree performed Required operation

(i) G, C, K, A, D, H, P, --, B, --, --, --, --, M, S INSERT N

(ii) 80, 30, 90, 10, 60, --, 95, --, --, 40, 70 INSERT 65

(iii) 80, 65, 90, 30, 75, --, 95, --, --, 70 DELETE 95

3. Given a hash table of size 12, use Division Method to map the following keys and apply Quadratic Probing for Collision
Resolution.
K = {98, 33, 69, 116, 53, 11, 229, 45}
Complete the hash table below:

0 1 2 3 4 5 6 7 8 9 10 11

Average number of probs for Successful Search =

λs =

Ravi Kant Sahu, Assistant Professor @ Lovely Professional University, Phagwara (Punjab)
CSE205: Data Structures & Algorithms
Test-3 (K18FR)

Roll No.:________________ Reg. No.:________________


Maximum Marks: 30 Time: 40 Min.
---------------------------------------------------------------------------------------------------------------------------------------------------
1. Apply the Huffman Encoding to draw the Huffman Code Tree for the following text and find the codes for the given characters:
little lilly is totally silly

l I t e s Y

2. Write an algorithm to delete an item from the Heap.

Given the Sequential Representation of the Heap, perform the Insertion/Deletion according to the operation mentioned in the table,
show all the steps and fill the details in the table after each operation:

Sequential Representation of the Given Heap Operation to be performed Sequential Representation of the Heap after the
operation

(i) P, M, F, H, B, D, A, C, G DELETE

(ii) P, M, F, H, B, D, A, C, G INSERT O

(iii) 20, 60, 62, 60, 65, 70, 80, 80, 70, 70, 80, 70 DELETE

3. Given a hash table with indexes 1 to 13, use Division Method to map the following keys and apply Double Hashing for Collision
Resolution using H`(K) = K mod 11 + 1.
K = {98, 33, 69, 117, 56, 138, 160}
Complete the hash table below:

1 2 3 4 5 6 7 8 9 10 11 12 13

Average number of probs for Successful Search =

λs =

Ravi Kant Sahu, Assistant Professor @ Lovely Professional University, Phagwara (Punjab)
CSE205: Data Structures & Algorithms
Test-3 (K18FR)

Roll No.:________________ Reg. No.:________________


Maximum Marks: 30 Time: 40 Min.
---------------------------------------------------------------------------------------------------------------------------------------------------
1. Apply the Huffman Encoding to draw the Huffman Code Tree for the following text and find the codes for the given characters:
rabbit is running

r a b i t g

2. Given the Sequential Representation of the AVL Search Tree, perform the Insertion/Deletion according to the operation
mentioned in the table, show the rotation and fill the details in the table after the rotation:

Sequential Representation of the Given AVL Tree Operation to be Rotation Sequential Representation of the AVL after the
performed Required operation

(i) 30, 10, 50, --, 20, 40, 80, --, --, --, --, --, --, 70, 90 INSERT 60

(ii) 40, 10 70, --, 20, 50, 80, --, --, --, --, 45, 60, --, 75 DELETE 20

(iii) G, C, K, A, D, H, P, --, B, --, --, --, --, M, S DELETE D

3. Given a hash table of size 10.


Use Mid-Square Method to map the following keys: 0

K = {23, 41, 8, 14, 20, 11, 19, 37} 1

Apply Open Hashing for Collision Resolution and show 2


The resultant Hash Table 
3
#Average Number of Probs for Unsuccessful Search
4

λU = 5

6
#Average Number of Probs for Successful Search
7

λs = 8

Ravi Kant Sahu, Assistant Professor @ Lovely Professional University, Phagwara (Punjab)
CSE205: Data Structures & Algorithms
Test-3 (K18FR)

Roll No.:________________ Reg. No.:________________


Maximum Marks: 30 Time: 40 Min.
---------------------------------------------------------------------------------------------------------------------------------------------------
1. Apply the Huffman Encoding to draw the Huffman Code Tree for the following text and find the codes for the given characters:
peter took hat trick

t r i c p k

2. Given the Sequential Representation of the Heap, perform the Insertion/Deletion according to the operation mentioned in the
table, show all the steps and fill the details in the table after each operation:

Sequential Representation of the Given Heap Operation to be performed Sequential Representation of the Heap after the
operation

(i) B, E, F, H, M, H, S, P, R, S, K DELETE

(ii) E, H, F, K, M, J, S, R, P, T INSERT G

(iii) 10, 30, 40, 40, 60, 50, 40, 50, 55 DELETE

(iv) 30, 40, 40, 50, 60, 50, 50, 40, 60 INSERT 30

3. Given a hash table of size 100, use Folding Method to map the following keys and apply Quadratic Probing for Collision
Resolution.
K = {98652, 1897, 84, 39189, 1433, 14006, 18002}
Complete the hash table below:

Index

Key

Average number of probs for Successful Search =

λs =

Ravi Kant Sahu, Assistant Professor @ Lovely Professional University, Phagwara (Punjab)
CSE205: Data Structures & Algorithms
Test-3 (K18FR)

Roll No.:________________ Reg. No.:________________


Maximum Marks: 30 Time: 40 Min.
---------------------------------------------------------------------------------------------------------------------------------------------------
1. Apply the Huffman Encoding to draw the Huffman Code Tree for the following text and find the codes for the given characters:
aunty ate apple and nuts

a u n t p s

2. Given the Sequential Representation of the AVL Search Tree, perform the Insertion/Deletion according to the operation
mentioned in the table, show the rotation and fill the details in the table after the rotation:

Sequential Representation of the Given AVL Operation to be Rotation Sequential Representation of the AVL after the operation
Tree performed Required

(i) K, D, P, B, H, N, T, --, --, --, --, --, --, R, V INSERT S

(ii) 50, 20, 70, --, 30, 60, 80, --, --, --, --, --, 65 DELETE 30

(iii) 30, 10, 40, 5, 20, 35, --, --, 8, 15, 25 INSERT 18

3. Given a hash table of size 10. 1


Use Division Method to map the following keys
In the given Hash Table  2

K= {36, 81, 109, 309, 212, 8, 110, 500, 27} 3

Apply Separate Chaining for Collision Resolution. 4

# Average number of probs for Successful Search 5

6
λs =
7

8
# Average number of probs for Unsuccessful Search
9

10
λU =

Ravi Kant Sahu, Assistant Professor @ Lovely Professional University, Phagwara (Punjab)
CSE205: Data Structures & Algorithms
Test-3 (K18FR)

Roll No.:________________ Reg. No.:________________


Maximum Marks: 30 Time: 40 Min.
---------------------------------------------------------------------------------------------------------------------------------------------------
1. Apply the Huffman Encoding to draw the Huffman Code Tree for the following text and find the codes for the given characters:
bad buddy is beaten badly

b a d i t y

2. Given the Sequential Representation of the Heap, perform the Insertion/Deletion according to the operation mentioned in the
table, show all the steps and fill the details in the table after each operation:

Sequential Representation of the Given Heap Operation to be performed Sequential Representation of the Heap after the
operation

(i) 30, 60, 50, 70, 80, 80, 85, 80, 75 DELETE

(ii) 50, 60, 70, 70, 80, 80, 85, 80 INSERT 55 A. 50, 55, 70, 70, 80, 80, 85, 80, 60

B. 50, 55, 70, 60, 80, 80, 85, 80, 70

C. 50, 55, 70, 60, 80, 80, 85, 80, 60

D. 50, 60, 70, 60, 80, 80, 85, 80, 55

(iii) C, H, K, L, K, P, T, R, N DELETE

(iv) H, K, K, L, M, T, Q, T INSERT M A. M, H, K, K, L, M, T, Q, T

B. H, K, K, M, L, T, Q, T, L

C. H, K, K, L, M, T, Q, T, M

D. None of These

3. Given a hash table with indexes 1 to 15, use Division Method to map the following keys in the given hash table:
K = {93, 32, 129, 71, 12, 45, 259, 83}

Use Double Hashing for Collision Resolution using the Hash Function H`(K) = K mod 7 + 1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Ravi Kant Sahu, Assistant Professor @ Lovely Professional University, Phagwara (Punjab)
Average number of probs for Unsuccessful Search =

λU =

Ravi Kant Sahu, Assistant Professor @ Lovely Professional University, Phagwara (Punjab)

You might also like