CSE3221 (Winter 2008) Assignment One
Deadline: Feb 4th (12:00 noon)
You have to work individually. You are not
allowed to view or exchange documents with your peers. We treat all sorts of
cheating very seriously. Do not copy code from anywhere, even as a `template''.
No late submission will be accepted. You are required to program in your PRISM
account. Your work will be graded based on: i) correctness of programming
logic; ii) clarity of your code and your coding style; iii) whether your code
follows the specification. It is your responsibility to explain clearly every detail
you do in the code with appropriate comments to avoid any possible confusion in
marking.
You are required to write two C programs to process some data sets. The programs will be able to calculate the median[1] value for each data set and print out results for all data sets according to the following required format. Each data set is stored in a file which consists of some integer numbers between 0 and 100. The file format is that all data samples in this data set are separated by whitespace in the file. As example, we have posted three data sets on the course Web: dataset1, dataset2, dataset3, for your reference. However, your program should be able to process any number of data sets which are passed through from the command line.
Filename1 median1 count1
Filename2 median2 count2
…
Your programs should compile as follows:
cc –o prs process.c
cc –o thr thread.c
–lpthread
And the programs should run as follows (all datasets are provided as command line arguments):
prs dataset1
dataset2 dataset3 …
thr dataset1
dataset2 dataset3 …
What to submit?
Submit two C programs using the following commands from your PRISM account:
submit 3221 a1
process.c
submit 3221 a1
thread.c
No hardcopy is needed
to submit for this assignment.
[1] Median value is defined as the number in a data set which separates the higher half of the data set from the lower half.