CMSC 246 Systems Programming
Spring 2021

Assignment #6: : Structs and Airports and Malloc!

This assignment builds on top of last weeks' Airport assignment.

The general idea in this assignment is to assume that you do not know the number of airports when you start. You will handle this problem by creating a data structure akin to the java ArrayList. Briefly, an array list has an underlying array in which data is stored. Whenever the number of items grows too large to fit within the current underlying array, the size of the underlying array grows by some amount. Growth occurs by creating a new, larger array. Then items in the old array are copied to the new, larger space and the old array is disposed.

After reading in all of the airports, (No you may not use unix wc to determine the number of lines in the file and thereby avoid the need to have a growable arraylist) rather than performing linear search (as in the previous assignment) use binary search to find airports given a code. The data in the file is sorted by code so binary search is possible without additional sorting.


Sample output: Once done, show your program's output for the following inputs: BMC, 172 (One Seven Two), 00M (Zero Zero Em), TCS, BUZ, 5A8, DAR, ZZV, 22M, PHL.

What to submit:

How to submit

  1. Do not use submit
  2. Use tar to create an compressed archive of your submission. Name the tar file something clever like YOURLOGIN_qwe_6.tar.gz where "qwe" is a set of three "secret characters".
  3. Copy your tar file to /home/gtowell/submissions/spring2021/cmsc246/project6. Only I can get a directory listing of this directory so the three secret characters keeps other students from accidentally overwriting (or reading) your work.
  4. Set permissions on your submission so that anyone can read but only you can write to the file. That way no one can accidentally overwrite your submission. If you do not allow anyone to read then I will not be able to read. This will result in a poor grade for the assignment (think zero).