404_HW8_F11

# 404_HW8_F11 - table of length m = 7 using hash function h (...

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

UML CS Analysis of Algorithms 91.404 (section 201) Fall, 2011 Page 1 of 1 Homework Set #8 Assigned: Wednesday, 11/9 Due: Friday, 11/18 (start of lecture) This assignment covers textbook material in Chapters 10-11. Note: Partial credit for wrong answers is only given if work is shown. 1. (40 points) Linked Lists : (adapted from Algorithm Design by Goodrich and Tamassia) Design an efficient “link-hopping” algorithm for finding the middle node of a doubly linked list with head and tail pointers and an odd number of nodes. You are not allowed to use a counter; just link-hopping. Provide pseudocode, correctness justification, and upper and lower bounds on the worst-case running time. 2 . (20 points) Hashing : Consider inserting keys 9, 5, 11, 1, 6 in the order given into a hash
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: table of length m = 7 using hash function h ( k ) = 2 k 2 mod m . a) Using h(k) as the primary hash function, illustrate the result of inserting these keys using open addressing with linear probing. b) Using h(k) as the primary hash function, illustrate the result of inserting these keys using open addressing with quadratic probing, where c 1 =2 and c 2 =1. c) Using h(k) as the hash function, illustrate the result of inserting these keys using chaining. Compute the load factor for the hash table resulting from the insertions. d) What different values can the hash function h ( k ) = 2 k 2 mod m produce when m = 7? Carefully justify your answer. 3. (40 points) Chapter 11: Textbook Problem 11-1 on p. 282 (a) - (d)....
View Full Document

## This note was uploaded on 02/13/2012 for the course CS 91.404 taught by Professor Dr.karendaniels during the Fall '09 term at UMass Lowell.

Ask a homework question - tutors are online