Computer Engineering 130
File Processing
Contents

 


Navigation

CmpE130 Lab Projects

Labs should be submitted using the UNIX utility provided—source code and makefile. Currently the submit utility is named submit2. Typing the command by itself will give instructions on how to use it.

The resulting executables must be named exactly as required by the problem specification. Command line arguments must be taken as specified in the assignment. Programs with non-standard names or interfaces will not be accepted.

Grading is done using a script. If your code does not meet the requirements of the script, it will not be graded.

For some reason, many students do not appear to be testing their makefile before submission. This is not a good idea. It is very easy to test a makefile. Simply type make.

All labs must be done individually. Any use of existing code taken from books or on-line sources must be properly cited. It is not acceptable to copy code from other students. The university policy can be found at http://www.sa.sjsu.edu/download/judicial_affairs/Academic_Integrity_Policy_S07-2.pdf.

Resubmission of labs:

Lab 1

Here is the example I went through in class:

Binary tree example

The following references may be useful:

Note also the example make file I demonstrated in class can be seen on the Linux account aala0895. This is an account that has been set to be readable from other accounts. However to run anything you must copy it to your own account and run it there.

Lab 2

Some people in previous semesters asked how to satisfy the requirement for writing the entire data object at once using stream-oriented I/O. There are probably many solutions, but the following is one that appears to work:

MyOutputFile.write((char*) &MyDataRecord, sizeof(MyDataRecord));

Don't try to write C++ standard strings this way. It doesn't work. (They don't have a known size.) C strings, structs or non-dynamic class objects should work fine, though.

Lab 3

Do you have questions about having multiple executables in one make file? Here is an tutorial. The first rule in the makefile is the default. That should be the one that has all the other individual rules as its dependencies.

Suggested structure:

  1. Binary search in index
    Given a key, the function returns two values, a location in the index and a Boolean value indicating whether the key was found in the index. The binary search should print each index location accessed (on one line, please!).
  2. Insert into index
    Since the binary search has already found the correct location, this value can be passed to the indexinsert function along with a key and RRN. Following entries in the index are moved down to make room for the new entry. The function should print the range of index entries which are being moved (first and last only).
  3. Delete from index
    Since the binary search has already found the correct location, this value can be passed to the indexdelete function. Following entries in the index are moved back to remove the index entry. The function should print the range of index entries which are being moved (first and last only).

I suggest that common functions should be placed in an include file.

Deadline extended to Nov. 22.

Lab 4

B-Tree code from second edition of text
This is a good example to use to see how to structure your code, especially if you are going to write your lab in C. The text (new edition) gives examples in C++, but the algorithm is not the one you should use.

There is one error in the code, if you download it from the link above. In the function create_tree( ), after the statement key = getchar( );, add the statement putroot(NIL); This is just to create an empty header record. Otherwise, the header record for the B-tree file is not written correctly on initialization.

There is a correctly running version of this code available on aala0895.

 

Lab 5

 

Supplementary lab material:

There is more B-tree stuff in the links at the bottom of the main CmpE130 page.