Do the following problems from the text:
Yes, these are results of theorems we gave you. We want you to show us.
Exercise 1.13 (e): For consistency with the definitions we only consider polynomials p that map the natural numbers onto the natural numbers, that is, you may assume that p is a function p:N->N.
This is to be done on the CS machines (tux.cs.drexel.edu , or one of the lab machines in UCross 151), and submitted via Blackboard
In this section you will use the cell data structure provided, and write two additional (non-member) functions, to build lists: concat and concat_copy. You will time how long it takes to build lists of various sizes using these functions.
Note that the cell data structure is also a list with one element. To make a list with two elements, you will concatenate two such cells. And so forth.
Don't actually copy the data from the lists A and B.
See the example file for timing a function. Write your results in a table:
100 | 9 | 11 |
---|---|---|
200 | 23 | 25 |
300 | 32 | 21 |
... | ... | ... |
(Of course, this is made-up data. Your data won't look anything like this.) If you save your data in a file called data.out, you can plot it with gnuplot using the included plot script like this:
gnuplot < plot-instructions
You can view the plot that you make by typing display plot.png or by using any other image viewer (including a graphical web browser). You can also run gnuplot manually, and if you don't change the terminal type to png, the graph will display on your screen directly. You may find this helpful as you are developing your code.
Feel free to modify the gnuplot script so that it works for you using the filename you choose and so forth.
Don't forget to provide a phony makefile target called run that depends on the above targets in order:
run: problem1 problem2 problem3 view