Solutions – Practical 1
This practical should have been straightforward, once you got to grips with the editor, Unix, and interaction with the ML system.
A simple answer to Question 2 would be
-
fun FF 0 = 1
| FF 1 = 3
| FF 2 = 5
| FF n = 1 + FF(n-1) + FF(n-3)
But this would take aeons to compute FF(200), so the iterative version given is necessary.
Since there was some confusion over what was intended (despite the fact that the instructions were clear), answers that counted internal nodes, rather than nodes, were also marked correct.
©Michael Fourman 1994-2006