From 6f03e66c7830278666b256108b80e62fc10a0e32 Mon Sep 17 00:00:00 2001 From: Tianyi Cui Date: Sun, 28 Nov 2010 06:14:18 +0000 Subject: [PATCH] 56 --- BinaryTrees.hs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/BinaryTrees.hs b/BinaryTrees.hs index 219661d..a80ceaf 100644 --- a/BinaryTrees.hs +++ b/BinaryTrees.hs @@ -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