Dr. Melissa Danforth

Computer and Electrical Engineering and Computer Science Department
California State University, Bakersfield

CSUB Logo
Skip navigation links

Download file viewer

Notes on Solutions
Most of the assignments done in this course, with the exception of the ones teaching specific languages like pure C or object-oriented programming with C++, will have many ways to code the data structure. Solutions will be given in multiple formats to show the many different ways the data structures may be coded. In addition to the syntax required for the assignment, solutions may be given in pure C, basic object-oriented programming, and/or object-oriented programming with template classes. The file name will say which style is being used.

Additionally, for data structures which can be coded as arrays, there may be a statically sized array version and a dynamically sized array version. The full list of alternate coding methods might be split amongst these two methods of allocating the array.

Naming Conventions for Solutions
The filename will indicate what coding style has been used for the file. Here are the naming conventions. In the name conventions <assignment> is the name of the assignment, such as hw1, and <file> is the name of the data structure, such as dynamiclist.
<assignment>.cpp
This is the official solution for the assignment. Your code should have resembled this solution to receive full points for the assignment.
<file>_purec.c
This is the pure C version of the data structure. Remember that you must use the gcc command to compile pure C programs.
<file>_oop.cpp
This is the basic object-oriented programming approach for the data structure.
<file>_template.cpp
This is the data structure coding in object-oriented programming with template classes, which allow for any type of data (int, char, float, etc) to be stored in the data structure.
For lab assignments, you will also occasionally have a lab that only completes a portion of the data structure. In that case, the full data structure using the required syntax for the lab will also be given. The full data structure file will be named after the data structure, with none of the above extensions to the filename. For example, in Lab 2 we created an incomplete array-based list. The fully implemented array-based list is given in the solutions as staticlist.cpp.