S-Q 1997 - Assignment 6
Makeup Assignment
Due 08/07/97 at 6:00pm Last Date Accepted: 08/11/97 at 6:00pm
Note: this is a makeup for one of the first three assignments. If you hand in a solution for any part of this assignment, your score for this assignment will replace your lowest score on any of the first three assignments. (Note that the graduate problem is treated differently, see below.)
All work should be done in directory /Q/asst6. The Makefile provided includes rules to build all the programs in this assignment; you shouldn't need to change it at all.
You may write your answers to the written questions in whatever manner you prefer- longhand, with UNIX tools, or via a word processor. Make sure to hand in a copy of whatever is appropriate given your choice.
There is an obvious O(N) solution- just work your way down the array testing each element in turn. Your algorithm should be much faster. Hint- this problem would be much harder if the array was not a sorted array of integers!
Complete the program named monte.c, to compute this probability with a confidence level of 99% and a margin of error of 1%.
For the sake of this problem, only consider the lower-case letters 'a' through 'z'.
A modified version of the hash tables from assignment 4 (along with the code to load the dictionary into a hash table) has been provided. Consult monte.c for more information. You may also find the pseudo-random functions in random.c to be useful.
Note that this exact problem is relatively silly; it would be less work to simply count the exact number of each of the kinds of words we are looking for by scanning the dictionary once than it would be to perform this experiment. However, if we were sampling from something that we couldn't scan entirely, this method would still work well.
For example, the string "AAAAAABCCCC" would be represented by the following 7 bytes: 6, 'A', 1, 'B', 1, 4, 'C'.
Your rle program should read its input from standard input (stdin), and write its output to standard output (stdout).
The UNIX utility od may be very useful, because it allows you to look at the values represented by bytes as numbers and/or ASCII characters.
A run-length decoder (sol_rld) and example solution encoder (sol_rle) are available to help you test your rle.
Weiss, problem 7.34.
Note: this is a makeup for the graduate problem on assignment 3 only. If you hand in a solution for this problem, your score for this problem will replace your score on the graduate problem from assignment 3.
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 asst6.tex.
The translation was initiated by Dan Ellard on Wed Jul 30 11:41:27 EDT 1997