hw2 Sols
hw2 Sols
IMPORTANT:
• Upload this PDF with your answers to Gradescope by 11:59pm on Sunday October 4,
2020.
• Plagiarism: Homework may be discussed with other students, but all homework is to be
completed individually.
• You have to use this PDF for all of your answers.
For your information:
• Graded out of 100 points; 4 questions total
• Rough time estimate: ≈1-4 hours (0.5-1 hours for each question)
Revision : 2020/09/28 21:04
1
15-445/645 (Fall 2020) Homework #2 Page 2 of 12
(a) [4 points] Insert keys 5 and 10. Select the resulting two tables.
2 A) 2 B)
Question 1 continues. . .
15-445/645 (Fall 2020) Homework #2 Page 3 of 12
C) 2 D)
(b) [4 points] Then delete 14, and insert 8. Select the resulting two tables.
2 A) 2 C)
2 D)
B)
Question 1 continues. . .
15-445/645 (Fall 2020) Homework #2 Page 4 of 12
(c) [6 points] Finally, insert 24. Select the resulting two tables.
2 A) 2 C)
2 D)
B)
(d) [6 points] What is the smallest key that potentially causes an infinite loop given the
tables in (c)
2 0 2 2 2 3 6 2 7 2 9 2 None of the above
Homework #2 continues. . .
15-445/645 (Fall 2020) Homework #2 Page 5 of 12
When answering the following questions, be sure to follow the procedures described in class
and in your textbook. You can make the following assumptions:
• A left pointer in an internal node guides towards keys < than its corresponding key, while
a right pointer guides towards keys ≥.
• A leaf node underflows when the number of keys goes below d d−1 2
e.
• An internal node underflows when the number of pointers goes below d d2 e.
Question 2 continues. . .
15-445/645 (Fall 2020) Homework #2 Page 6 of 12
(a) [15 points] Insert 14∗ into the B+tree. Select the resulting tree.
2 A)
2 B)
C)
Question 2 continues. . .
15-445/645 (Fall 2020) Homework #2 Page 7 of 12
2 D)
(b) [5 points] How many pointers (parent-to-child and sibling-to-sibling) do you chase to
find all keys between 5 and 15?
2 2 2 3 4 2 5 2 6 2 7
(c) [15 points] Then delete 23∗ . Select the resulting tree.
2 A)
2 B)
2 C)
Question 2 continues. . .
15-445/645 (Fall 2020) Homework #2 Page 8 of 12
D)
(d) [10 points] Finally insert 4∗ and delete 3∗ . Select the resulting tree.
A)
2 B)
2 C)
2 D)
Homework #2 continues. . .
15-445/645 (Fall 2020) Homework #2 Page 9 of 12
Figure 3: Extendible Hash Table along with the indexes of each bucket
Question 3 continues. . .
15-445/645 (Fall 2020) Homework #2 Page 10 of 12
Homework #2 continues. . .
15-445/645 (Fall 2020) Homework #2 Page 11 of 12
(a) [3 points] Which of the following elements belong to the suffix tree. Select all that ap-
ply.
2 0xCABEACCA 2 0xCA1337BF 2 0x77BDBECA 2 0xBAABCABE 2 0xCABEBC04
None of the above
(b) [7 points] Insert the key 0xCABEBADE. Select the resulting tree.
A) 2 B)
Question 4 continues. . .
15-445/645 (Fall 2020) Homework #2 Page 12 of 12
2 C) 2 D)
End of Homework #2