Hi Andrew,
| Hey all.. I was wondering if somebody might offer me some assistance in
| trying to debug some code I wrote to check whether a tree is a binary
| search tree.. For some reason it always comes back as false! :( Thanks
| much!
One of the great things about functional programming is t
Assuming this isn't a homework exercise...
> 1) If current node is empty then this portion of tree is a BST
> 2) if the left subtree and right subtree's are both not empty then ...
The logical negation of your second clause (which is what is picked
up by the 'otherwise' clause of your code) is
Mon, 17 Apr 2000 14:47:49 -0400 (EDT), Sitzman <[EMAIL PROTECTED]> pisze:
> > | otherwise = False
2
/ should be a BST too.
1
> >checkL = ((treeVal (leftSub thetree)) < (treeVal (thetree)))
> >checkR = ((treeVal (rightSub thetree)) > (treeVal (thetree)))
It's not enough:
3
Hey all.. I was wondering if somebody might offer me some assistance in
trying to debug some code I wrote to check whether a tree is a binary
search tree.. For some reason it always comes back as false! :( Thanks
much!
-Andrew Sitzer
> isBST :: Ord a => Tree a -> Bool
> isBST thetree
> | isNil