From 78c9730055042764247f961889f380cbe8ab5f42 Mon Sep 17 00:00:00 2001 From: Jim Pryor Date: Thu, 23 Dec 2010 21:52:09 -0500 Subject: [PATCH] prep ass10 for more hints Signed-off-by: Jim Pryor --- assignment10.mdwn | 11 ++++++----- hints/{assignment_10_hint.mdwn => assignment_10_hint_1.mdwn} | 0 hints/assignment_10_hint_2.mdwn | 0 3 files changed, 6 insertions(+), 5 deletions(-) rename hints/{assignment_10_hint.mdwn => assignment_10_hint_1.mdwn} (100%) create mode 100644 hints/assignment_10_hint_2.mdwn diff --git a/assignment10.mdwn b/assignment10.mdwn index d7e0e235..8e5bf2da 100644 --- a/assignment10.mdwn +++ b/assignment10.mdwn @@ -39,15 +39,16 @@ Of course, if you need help or want us to review your efforts, we'll be glad to solution that traverses the tree exactly once, replacing each leaf as soon as you see it? - Consider a variation in which you must replace each leaf with - its number of occurrences in the tree. Is there any way to do - that with a single traversal? - You can assume that the tree is binary, leaf-labeled (no labels on the internal nodes), and that the leafs are, say, chars. - Here is [a hint](/hints/assignment_10_hint). + Here is [a hint](/hints/assignment_10_hint_1). + + Consider a variation in which you must replace each leaf with + its number of occurrences in the tree. Is there any way to do + that with a single traversal? (Here is [a hint](/hints/assignment_10_hint_2).) + 2. Armed with your solution to problem 1, try this: you have as input a leaf-labeled, binary tree whose labels are strings. You also have as input an interpretation function from strings to meanings. Let the meanings of your strings be primitive elements, for instance: diff --git a/hints/assignment_10_hint.mdwn b/hints/assignment_10_hint_1.mdwn similarity index 100% rename from hints/assignment_10_hint.mdwn rename to hints/assignment_10_hint_1.mdwn diff --git a/hints/assignment_10_hint_2.mdwn b/hints/assignment_10_hint_2.mdwn new file mode 100644 index 00000000..e69de29b -- 2.11.0