diff options
author | Joe Zhao <ztuowen@gmail.com> | 2015-04-13 15:21:21 +0800 |
---|---|---|
committer | Joe Zhao <ztuowen@gmail.com> | 2015-04-13 15:21:21 +0800 |
commit | a39aea354b071612c071d98125e879fe14c76a54 (patch) | |
tree | 9d960eb2c970245e4fa5ffc2b51c25e0547972fb /H62.hs | |
parent | 84e6753005e57827c78b50ad0a26ffa0d0da55e4 (diff) | |
download | h99-a39aea354b071612c071d98125e879fe14c76a54.tar.gz h99-a39aea354b071612c071d98125e879fe14c76a54.tar.bz2 h99-a39aea354b071612c071d98125e879fe14c76a54.zip |
+61 +62 +63
Diffstat (limited to 'H62.hs')
-rw-r--r-- | H62.hs | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -0,0 +1,14 @@ +import Tree +-- import Tree4 + +leaves Empty = [] +leaves (Branch x Empty Empty) = [x] +leaves (Branch x t1 t2) = leaves t1 ++ leaves t2 + +internals Empty = [] +internals (Branch x Empty Empty) = [] +internals (Branch x t1 t2) = [x] : internals t1 ++ internals t2 + +atLevel Empty _ = [] +atLevel (Branch x _ _) 1 = [x] +atLevel (Branch _ t1 t2) n = atLevel t1 (n-1) ++ atLevel t2 (n-1) |