Skip to content

Commit

Permalink
61
Browse files Browse the repository at this point in the history
  • Loading branch information
tianyicui committed Dec 2, 2010
1 parent 6db803b commit db46b7d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions 54A-60/BinaryTrees.hs → BinaryTrees.hs
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,7 @@ hbalTreeNodes n =
, tl <- calc nl hl
, tr <- calc nr hr
]

countLeaves Empty = 0
countLeaves (Branch _ Empty Empty) = 1
countLeaves (Branch _ l r ) = countLeaves l + countLeaves r

0 comments on commit db46b7d

Please sign in to comment.