[Haskell] Binary Tree Traversal.

Stefan Holdermans sholderm at students.cs.uu.nl
Thu Mar 10 12:02:49 EST 2005


Paul,

Are you sure this isn't homework? ;)

> data BinTree a = Nil | Node a (BinTree a) (BinTree a)
>
> inorder2 :: BinTree a -> [a] -> [a]
> inorder2 Nil xs = []
> inorder2 (Node val b1 b2) xs = (inorder2 b1 (val:(inorder2 b2 (xs))))

Review the case for []. What does the parameter xs represent? How 
should it be involved in constructing the result?

HTH,

Stefan



More information about the Haskell mailing list