# hw2 - collisions.) Carefully explain your reasoning, and...

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

Data Structures and Algorithms (CS 130A) Prof. Suri Homework Assignment 2 Handed Out: Jan 20 Due: Jan 27 1. (15 pts) Given the hash function h ( x ) = x mod 10, and the following set of numbers as input { 4371 , 1323 , 6173 , 4199 , 4344 , 9679 , 1989 , 7759 } , show the resulting: (a) Separate chaining hash table, (b) Open addressing hash table with linear probing. (c) Open addressing using quadratic probing. 2. (10 pts) Suppose we map N keys into a table of size N , using a random hash function that maps each input key to any table position with equal probability. What is the probability that each table entry receives exactly one key? (That is, there are no
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: collisions.) Carefully explain your reasoning, and give your nal answer in the simplest possible mathematical form. 3. (15 pts) Suppose H is a binary min-heap with n nodes. Show the following facts for H (a) H has exactly d n/ 2 e leaves. (b) The maximum key is at one of the leaves. (c) Any algorithm that correctly performs ndMax must inspect every leaf node in H . 4. (10 pts) Suppose we use the array representation to store a d-heap. For an entry located in position i , where are its parent and children located? Give both the formulae and their justication....
View Full Document

## This note was uploaded on 12/27/2011 for the course CMPSC 130a taught by Professor Suri during the Fall '11 term at UCSB.

Ask a homework question - tutors are online