Skip to content

Commit

Permalink
56
Browse files Browse the repository at this point in the history
  • Loading branch information
tianyicui committed Nov 28, 2010
1 parent 5047406 commit 6f03e66
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions BinaryTrees.hs
Expand Up @@ -15,3 +15,12 @@ cbalTree n =
, ta <- cbalTree p
, tb <- cbalTree q
]

symmetric (Branch _ ta tb) = mirror ta tb
symmetric _ = False

mirror Empty Empty = True
mirror (Branch _ t1a t1b)
(Branch _ t2a t2b) =
(mirror t1a t2b) && (mirror t1b t2a)
mirror _ _ = False

0 comments on commit 6f03e66

Please sign in to comment.