S-Q 1997 - Assignment 4 Due 07/24/97 at 6:00pm Last Date Accepted: 07/28/97 at 6:00pm
All work should be done in directory /Q/asst4. The Makefile provided includes rules to build all the programs in this assignment; you shouldn't need to change it at all.
You do not need to implement your algorithms, but your description must be detailed enough so that it could be converted into code quite easily by anyone with an existing library of 2-3 tree code.
Write your answers to this question in a file named asst4.txt. If you prefer to write out your algorithms by hand (or using a word processor), simply note this in your asst4.txt and turn in your hardcopy in class.
The file dict.c is a main driver for a program that reads the contents of a 25,000-word dictionary into a list, creates several hash tables based on this data, and computes some metrics for each table.
Note- your goal is not to invent the world's greatest hashing function, but simply to see if you can exploit any of the characteristics of this set of keys to devise a better hashing function- or to explain why a hash function that looks good is actually not appropriate for this data.
Write your answers to this question in a file named asst4.txt. If you prefer to write out your algorithms by hand (or using a word processor), simply note this in your asst4.txt and turn in your hardcopy in class.
Your procedure may require tossing the unfair coin several times. Be sure to give an estimate of how many times you need to toss the unfair coin. For the sake of this problem, you may assume that the probability of the unfair coin coming up heads is always 0.25 < p < 0.75 (no need to worry about two-headed or two-tailed coins).
Hint- the first solution that many people immediately think of is wrong, so double-check your logic!
Once again, your procedure may require multiple coin tosses. Be sure to give an estimate of how many times you will need to toss the fair coin.
Implement skipListInsert and skipListLookup to complete the implementation of skiplist.c. You may assume that the maximum level of the list is defined as MAX_LEVELS (which is defined in skiplist.c). Once again, be sure to document your code; a reasonable approach is worth many points, even if the code does not function perfectly. Skip lists are described in Weiss, section 10.4. You may find the FairCoin function (defined in random.c) to be useful.
Your insertion routines should be efficient- by keeping track of the last node visited at each level, you will know exactly which nodes you need to update with pointers to new node. Note that only the most recently visited node at each level (and only nodes to the left of the key) need to be updated during an insertion- therefore it is easy to keep track of all the nodes that have to be updated. Once again, you will find this much easier to understand if you draw a picture of what has to happen at each step.
This document was generated using the LaTeX2HTML translator Version 96.1-h (September 30, 1996) Copyright © 1993, 1994, 1995, 1996, Nikos Drakos, Computer Based Learning Unit, University of Leeds.
The command line arguments were:
latex2html -split 0 asst4.tex.
The translation was initiated by Dan Ellard on Thu Jul 17 10:56:00 EDT 1997