Table of Contents

LABs

LAB 1

Lab 1 is here for lab 1, the grade is on attendance. You must submit the deliverable during the lab time.

You will get a marking report for the program but it will not be counted towards your final grade. This is only an example of how we mark your work.

Always check the lab during the lab hours. Some times there will be some changes/modifications to make it clearer. The changes are in bold red font so it will be easy for you to spot it

LAB 2

Lab 2 is here. I will post soon samples input and outputs. You have to prepare your own set. My set will not cover all scenarios.

here is an example in file and out file

Please use od to see the contents of the files.

a detailed description is here. Every line contains the stock price, the changes from the previous day, and the action taken

labs are due midnight Friday

here is one way to implement lab 2 invest.c note that the programs explain what is happening every day not just prints the results

LAB 3

Here is Lab 3 (n < 50)

And here are some exercise problems (do not submit)

some input and output files

A BUG in the OUTPUT SAMPLE

please add one line to the output sample file. That line is

123456789 Aboelaze

That line should be added after the second or third line in the output file. Since I didn't specify the order multiple top students should be displayed, either order is fine

LAB 4

Here is lab 4

You can assume that the maximum record length is 50 and the maximum value for k is 256

Also note that I am asking for the number of entries with collisions, not number of collisions.

here is a sample input file and the corresponding output file

here is another input file and sample output detailing the hash table enry. This is not what you should submit, just to help you with debugging I displayed the number of elements mapped to each hash table entry

For both cases, k=10

Here is one way to implement hash.c this is just one way of doing it. There are many other ways, some may be even more efficient.

LAB 5

Here is Lab 5

Note the new due date (feb. 22)

I will be posting test cases and binary files soon

Submit as books.c to L5

Text Cases

If you run the program for the first tome (no book.dat) with this input in1.txt the output is out1.txt and the file book_dat.txt (rename this file to book.dat, it could not be uploaded with extension .dat

if you run the program the second time with book.dat as before, the input is in2.txt and the output is out2.txt

LAB 6

Here is Lab 6

The student names are 50 characters or less

Due midnight Sunday March 5

Now few pointers:

You will read from the standard input, the number k followed by names. If you use scanf to read K, then use fgets to read names (it might contain spaces, so you can not use scanf easily), you will have a problem getting rid of the newline after the number k.

I would suggest to use fgets t read both, then use sscanf to read k from the string you read.

So, instead of

scanf(“%d”, &k); you can use

fgets(s, sizeof(s), stdin);

sscanf(s, “%d”, &k);

records file

records.txt

Input and output files

l6_in1.txt and l6_out1.txt for the given file records.txt

This is not input output samples, but will help you to be with testing

This is a hash table with k=7 det7.txt it shows the hash table with the records mapped to the different lists, the records are <name, final_mark> the fial mark is between two parenthesis.

Here is for k=10 det10.txt

Here is a solution for lab 6 L6.c

LAB 7

Here is lab 7

The lab is due March 19

LAB 8

here is Lab 8

Due last day of classes