Midterm 2 Review

# Gxisthe secondaryhashfunction 6

This preview shows page 1. Sign up to view the full content.

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

Unformatted text preview: nd (c) in the case of secondary hashing assuming g(x) = 7. (g(x) is the secondary hash function.) 6) Apply LZW algorithm to the following text: ababbababbabbababbabab 8) Define the following terms: (a) heap property (b) complete binary tree (c) full binary tree. 9) Draw a min‐heap with 12 nodes in the form of a binary tree. 10) What is the result of inserting 12 into the heap of Figure 6.5 (a), page 217? What is the result of performing DeleteMin on the resulting heap? 11) Let A be an array of integers in which some keys are stored in indices 1 to k. Write a procedure that takes as input A and k, and determines if A[1 : k] forms a min‐heap. What is the time complexity of this algorithm? Hint: Check at each node (except the root) that its key is >= its parent key. 12) How many different min‐heaps can you form using the keys 1, 2, 3, 4, 5, 6 and 7? Hint: The root must contain 1, the remaining 6 keys can be arbitrarily split into two groups A and B each with 3 numbers and can be used to fill th...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online