Tutorial Exercises Week 08

Exercise 0

Finish any of the questions from Exercise 7 from last week if you did not get to do them.

Exercise 1

Balanced Trees

Explain how we could globally balance a binary search tree using the partition function.

Exercise 2

Splay Trees

Exercise 3

Hashtables

Draw a hash table of size 13. Use the hash function "k%13" and insert the keys: 5, 29, 32, 0, 31, 20, 23 and 18 into your table (in that order) using the following strategies for handling collisions.

  1. Chaining
  2. Linear Probing
  3. Double Hashing with a second hash function "7 - (k%7)". (Why would a second hash function such as "k%7" not be very useful?)

If there is any remaining time, use it to finish any questions that you did not cover in previous weeks.