Practice Test 2 - Data Structures and Algorithms | CP SC 212, Exams of Algorithms and Programming

Material Type: Exam; Class: ALGS/DATA STRUCTURES; Subject: COMPUTER SCIENCE; University: Clemson University; Term: Spring 2009;

Typology: Exams

Pre 2010

Uploaded on 07/28/2009

koofers-user-t7w
koofers-user-t7w 🇺🇸

8 documents

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CPSC 212-001 Name: _____________________________
Test #2 March 5, 2009
Honor Pledge:
I pledge that I have neither given nor received unauthorized assistance on this test.
Signed: _______________________ Date: _____________
Closed books. Closed notes. Calculators OK. 105 points. 75 minutes. Weight of each question in parentheses.
Please use a pencil. For more space, use the back of the sheet. For scratch paper, ask the proctor Hao Jiang.
1. (5) Insert the values in set A into an initially empty skew min heap. Show only the final tree.
(5) Then insert the values in set B into an initially empty skew min heap. Show only the final tree.
A: 13 44 62 98 43 16 24 B: 29 84 67 19 15 44 11
(5) Finally, merge heap A with heap B. Show only the final tree.
2. (10) Insert the following into a B-Tree with M=3 and L=4. Ignore duplicates. Show only the final tree.
61 27 19 5 7 25 36 4 27 42 2 13 44 62 98 43 16 24 29 15
pf3
pf4

Partial preview of the text

Download Practice Test 2 - Data Structures and Algorithms | CP SC 212 and more Exams Algorithms and Programming in PDF only on Docsity!

CPSC 212-001 Name: _____________________________

Test #2 March 5, 2009

Honor Pledge:

I pledge that I have neither given nor received unauthorized assistance on this test.

Signed: _______________________ Date: _____________

Closed books. Closed notes. Calculators OK. 105 points. 75 minutes. Weight of each question in parentheses. Please use a pencil. For more space, use the back of the sheet. For scratch paper, ask the proctor Hao Jiang.

1. (5) Insert the values in set A into an initially empty skew min heap. Show only the final tree. (5) Then insert the values in set B into an initially empty skew min heap. Show only the final tree. A: 13 44 62 98 43 16 24 B: 29 84 67 19 15 44 11 (5) Finally, merge heap A with heap B. Show only the final tree. 2. (10) Insert the following into a B-Tree with M=3 and L=4. Ignore duplicates. Show only the final tree. 61 27 19 5 7 25 36 4 27 42 2 13 44 62 98 43 16 24 29 15

3. (10) Assume that a disk block (sector) can hold 64K bytes. Assume that a record key is 128 bytes long and that a disk reference requires 8 bytes. What is the maximum size that M can take, where M is the number of children and (M–1) is the number of keys contained in an interior node of a B-Tree. Show clearly how you arrived at your answer. 4. (10) Assume that a disk block can hold 64K bytes. Assume that a record, including the key, is 2K bytes long. What is the maximum size that L can take, where L is the number of records contained in a leaf node of a B- Tree. Show clearly how you arrived at your answer. 5. (10) Perform the following operations on an initially empty Leftist max Heap. Repeat: max Heap_. Show only_ the final heap. Note that “D” means “delete”. 57 23 26 34 D 16 24 29 19 5 7 D 15 61 27 D 4 6. (10) Perform the following operations on an initially empty binomial min-queue. Repeat: min-queue. Show only the final queue. Note that “D” means “delete”. 57 23 26 34 D 16 24 29 19 5 7 D 15 61 27 D 4

d) (Fill in the blank) You should consider rehashing when the hash table _____________________________. e) ______ What is the max number of records that can be stored in a B-Tree with M=4, L=5, and height h=5.