H35-SectionHandout9

H35-SectionHandout9 - CS106B Winter 07-08 Handout #35 March...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CS106B Handout #35 Winter 07-08 March 9, 2008 Section Handout #9 Problem 1: Choosing a Good Hash Function Comment on the effectiveness and appropriateness of the followed suggested hash functions: (a) The table has 2048 buckets. The search keys are peoples' names. hash(key) = ASCII value of the first letter of key mod 2048 (b) The table has 1000 buckets. The search keys are integers in the range 0. .999. hash(key) = (Product of the digits of key) mod 1000 (c) The table has 1000 buckets, the search keys are integers in the range -32768 to +32767. hash(key) = (key*RandomInteger(1,100)) mod 1000 Problem 2: Understanding graph algorithms Those of you who have played Clue will recognize the following undirected graph, which shows the connections between the various rooms on the game board: Kitchen Ball Room Conservatory Lounge Hall Study Billiard Room Library Dining Room 7 4 8 4 4 11 7 4 7 3 3 6 7 8 7 The numbers on the various arcs show the distance (measured in spaces on the board) between pairs of rooms. For example, the distance from the Hall to the Lounge is 4 steps, and the distance from the Ball Room to the Billiard Room is 6 steps. In this problem, the secret passages that connect the rooms at the corners of the board (the Kitchen-Study and Lounge-Conservatory arcs) are arbitrarily assumed to have distance 3. a)
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/12/2011 for the course CS 108 taught by Professor Smith during the Spring '11 term at Central Mich..

Page1 / 3

H35-SectionHandout9 - CS106B Winter 07-08 Handout #35 March...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online