Machine Problem 3, due at the end of Oct 14

Part of the homework for CS:2630, Fall 2019
by Douglas W. Jones
THE UNIVERSITY OF IOWA Department of Computer Science

Framework: Your program must begin and end as follows:

	TITLE	"mp3.a by Your Name Here
	USE	"hawk.h"
	USE	"stdio.h"

	... your code hre ...

	USE	"/mnt/nfs/clasnetappvm/fs3/dwjones/2630mp3.h"
	END

Obviously, where it says Your Name Here put your name, and where it says ... your code here ... put SMAL Hawk code to solve the problem.

Details: The last header file mentioned above, ...2630mp3.h defines the following symbols:

The data structure for the tree is in read-only memory, so your program may not modify any of it.

Your job is to write a function called TRAVERS that traverses the tree and returns a string, the result of concatenating all of the strings in the tree (without adding any newlines or other content) in lexicographic order (also known as an inorder concatenation). Curiously, it doesn't matter if you traverse the tree in preorder, inorder or postorder, so long as you concatenate the strings in the right order afterwards. You will need to use MALLOC to allocate space for the concatenated strings, STRLEN to measure the size required, and either STRCPY or STRCAT to put each piece of the string into its final place. Please solve HW6 first!

You must not write a main program. That is provided. It will print out the string returned by TRAVERS.

Grading: 5 points. Correct output is worth 2.5 points. The remaining credit will be offered only for those who have at least partially correct output.

Code that does not assemble will not earn any credit.

Stylistically clean code is important; that is why half the credit is reserved for style, but only if the code works. Bad indenting will be penalized up to 1 point from the 2.5 style points. Excessive or inadequate white space within and between lines will be penalized, again, up to 1 point. Excessive or inadequate comments will be judged similarly.

Note: Comments should not repeat the assignment. Assume that the reader of your code has read the assignment. Assume that the reader knows how to program, so commenting ADDSI R1,1 with R1=R1+1 would be stupid. Comments should help the reader when the code is hard to follow.

Before you submit: Assuming your code is in a file named mp2.a, please use the command

   [HawkID@fastx?? ~]$ ~dwjones/format mp2.a

This will gripe about over-length lines, strange mixing of tabs and spaces, and other file-format issues that will make your code hard to read when printed out for grading but might not be obvious when you have the file open for editing.

Submission: To submit your work, it must be in a file named mp3.a in your current directory on the CLAS Linux system, and you must know your section number. In the following transcript of a submission, what you type is shown in bold face.

   [HawkID@fastx?? ~]$ submit mp3.a
   Course (for CS:1210 use CS1210): CS2630
   Possible submit directories for /group/submit/CS2630 are:
   
   mp3/a3
   mp3/a2
   mp3/a4
   mp3/b11
   mp3/b12
   mp3/b13

   Choice:   mp2/a2
   * File/directory mp3.a has been 
   *  copied to /group/submit/CS2820/mp2/a2/mp2.a.HawkID.
   [HawkID@fastx?? ~]$

The output saying "File ... has been copied ..." is your confirmation of successful submission. In the event of insurmountable trouble, do not delete or edit files you have submitted. Keep them around. It is safe to make copies if you want to keep playing with them. Keep the original on the CLAS Linux system until your graded work is returned. This way, the time stamp marking the time of last edit is a trustworthy indicator of whether you did the work on time.