This commit is contained in:
Aaro Koivukangas
2025-12-23 22:36:01 +02:00
parent 5b3f97897c
commit 9bc9c12a43
+2 -1
View File
@@ -27,7 +27,8 @@ valAtRoot Empty = Nothing
-- treeSize (Node 3 (Node 7 Empty Empty) (Node 1 Empty Empty)) ==> 3
treeSize :: Tree a -> Int
treeSize t = todo
treeSize (Node _ t1 t2) = 1 + (treeSize t1) + (treeSize t2)
treeSize Empty = 0
------------------------------------------------------------------------------
-- Ex 3: get the largest value in a tree of positive Ints. The