

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Assignment; Professor: Huan; Class: Data Structures; Subject: Elect Engr & Computer Science; University: University of Kansas; Term: Fall 2008;
Typology: Assignments
1 / 3
This page cannot be seen from the preview
Don't miss anything!


Homework 1 Assigned Sept 4th Due: Sept 18th
The problem:
You code should not assume the maximal number of elements that can be inserted into a vector. Basic error handling should be there.
How to test your code : You should name your executables as “vadt” for the vector ADT class, “sadt” for the stack ADT class, and “a2p” for converting an arithmetic operation to the postfix expression.
For the vector class executable vadt, it should accept an in-line parameter, which is the name of the testing file. For example, to run vadt, you should type: $vadt vtest where vtest is a testing file. You do not necessary name your test file as vtest.
The testing file for the vector ADT class is a set of commands, one at each line. Each command is composed of the name of the related function and the related parameters (without parenthesis and comma). For example: the following is a valid testing file for the vector class:
Insert a 3 Delete 2 Print Push_front b Pop_end Print
Notice that in this case, I will never test functions such as Size(), isEmpty(). You need to test these functions internally.
For the stack class executable sadt, it should accept an in-line parameter, which is the name of the testing file. The testing file for the stack ADT class is a set of commands, one at each line. Each command is composed of the name of the related function and the related parameters (without parenthesis and comma).
For the executable “a2p”, it should expect an in-line parameter, which is the name of the testing file. The testing file for the a2p executable is a list of arithmetic operations (in infix format). Your executable should convert them to the related postfix expression.
What to hand in: (1) Source codes with a makefile. If you do not use makefile before, the following is a good tutorial: http://frank.mtsu.edu/~csdept/FacilitiesAndResources/make.htm. Source code needs to be properly commented.
(2) A report with the following components: a. A brief discussion of the data structure that you use to implement the first two ADTs. Justify your answer.
b. A brief discussion of the algorithm that you use to solve the problem 3.
c. Show your test files and your testing results. You may use typescript to capture unix output. If you are not familiar with script and typescript, see http://www.tech-faq.com/capture-unix-terminal-session.shtml.
For example in Unix/Linux environment, assuming you have an executable named “vadt” and a test file “tvadt”, you may recode the testing results in the following way:
$script #start scripting $cat tvadt #show testing file contents $vadt tvadt #run your code