{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

This preview shows pages 1–4. Sign up to view the full content.

Short Answers 1 . Suppose that we want to create a heap where each node contains information of some data type. What additional factor is required for the data type ? 2 . A heap is a binary tree where the entries can be compared using the usual six comparison operations (that form a total order semantics). Write the two rules that the binary tree must follow in order for the structure to actually be a heap . 3 . Give two different reasons to explain why the following binary tree is not a heap : 4 . 91 5 . \ / 6 . 77 46 7 . \ \ / 8 . 68 81 11 9 . Draw a new heap that is created by inserting 82 into the following heap : 10 . 910 11 . \ / 12 . 77 66 13 . \ / \ / 14 . 68 1 3 11 15 . Draw a new heap that is created by removing one item from the following heap : 16 . 910 17 . \ / 18 . 77 66 19 . \ / \ / 20 . 68 1 3 11 21 . Suppose that you are performing a reheapification downward. Write a precise condition that describes the situation that causes the reheapification to stop . 22 . Suppose that you are performing a reheapification upward. Write a precise condition that describes the situation that causes the reheapification to stop . 23 . Suppose that a non-leaf node in a B-tree contains 42 entries. How many children does the node have ?

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
24 . Draw an example of a B-tree with four nodes and seven integer entries. The value of MINIMUM is 1 for this tree . 25 . Draw a new B-tree that is created by inserting 82 into the following B-tree. For this example, the minimum number of items in each node is 1. Note that the rightmost leaf starts with two entries, 71 and 93 . 26 . 56 27 . \ / 28 . 7 66 29 . \ / \ / 30 . 2 8 63 71 and 93 31 . Draw a new B-tree that is created by deleting 63 from the following B-tree. For this example, the minimum number of items in each node is 1. Note that the rightmost leaf starts with two entries, 71 and 93 . 32 . 56 33 . \ / 34 . 7 66 35 . \ / \ / 36 . 2 8 63 71 and 93 37 . Suppose that a B-tree is declared so that MAXIMUM (the maximum number of items in a node) is 84. What is the value of MINIMUM (the minimum number of items in a non-root node ?( 38 . Suppose that a B-tree is declared so that MAXIMUM (the maximum number of items in a node) is 84. Write one clear sentence to describe why each node's data array is set up to hold up to 85 items (one more than MAXIMUM .( 39 . Suppose that a and b are two positive integers and n is some non- negative number. Write an equation to show the relationship between log base a of n and log base b of n. Give a derivation to show that the relationship is valid . Multiple Choice 1 . What feature of heaps allows them to be efficiently implemented using a partially filled array ? o A. Heaps are binary search trees . o B. Heaps are complete binary trees . o C. Heaps are full binary trees . o D. Heaps contain only integer data .
2 . If a heap is implemented using a partially filled array called data, and the array contains n elements (n > 0), where is the entry with the greatest value ?

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}