2011Winter2009_Assignment3

2011Winter2009_Assignment3 - {4371, 1323, 6173, 4199, 4344,...

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

View Full Document Right Arrow Icon
1 Department of Computer Science and Engineering York University, Winter 2009 CSE 2011: Assignment 3 Due Date - Saturday, May 23, 7pm! Question 1 3-ary Tree [35 points] Let T be a full 3-ary tree (see Figure 1); that is, each parent has exactly 3 children. Let H(n) denote the height of this tree, where n represents the number of nodes in the tree. Prove the following is true for all full 3-ary trees: H(n) = log 3 (2 n+1) -1 Hint: use induction! Figure 1 Full 3-are tree Question 2 Heap [35 points] Design an algorithm for finding the ( n )-th largest element from an unsorted array of n elements. (In an array of 100 elements, this would be the 10 th largest, or in an array of 10,000 elements this would be the 100 th largest element.) Consider using a heap. Your algorithm should run in O(n) time. Question 3 Hash Table [30 points] Given the input sequence
Background image of page 1

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

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

Unformatted text preview: {4371, 1323, 6173, 4199, 4344, 9679, 1989} , a hash table of size b = 10 , and a hash function h(x) = x mod b , show the final (i.e. resultant) hash table in each of the following cases. a. [6 points] An open hash table, with insertion at the front of the chain. b. [8 points] A closed hash table using linear probing. c. [8 points] A closed hash table using quadratic probing. d. [8 points] A closed hash table using double hashing, with the second hash function as: h(x) = 7 - (x mod 7). 2 which yields the sequence of hash functions: hi(x) = (x mod b + i (7-(x mod 7))) mod b, for i=0,1, If, during the course of inserting into the hash table, you reach a point when it is not possible to complete the insertion, then note this in your write-up. Briefly explain what happened to prevent the insertion and why....
View Full Document

Page1 / 2

2011Winter2009_Assignment3 - {4371, 1323, 6173, 4199, 4344,...

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