Binary tree height predicate? 
Author Message
 Binary tree height predicate?

How do you make a predicate that counts the height of a binary tree?
(Edinburgh syntax)

Thanks in advance,



Sat, 01 Apr 2000 03:00:00 GMT  
 Binary tree height predicate?

Quote:

>How do you make a predicate that counts the height of a binary tree?
>(Edinburgh syntax)

Well, the height of an empty tree is 0, and the height of a
non-empty tree is 1 plus the max of the heights of the two sub-trees.
This definition should imply a simple recursive predicate with
two clauses which is just a translation of that definition into
predicate logic.

Thomas
--
ZZ:wq!
^X^C

AD DEUM ET VINUM                                      Every sword has two edges.



Sat, 01 Apr 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Self-Adjusting Binary Search Trees (Splay Trees)

2. Self-Adjusting Binary Search Trees (Splay Trees)

3. AVL Tree,Binary Tree,Sorting..

4. Height-balanced tree, source code wanted.

5. help with node height in a tree

6. Suite of tree/heap predicates?

7. Help: making a binary predicate reversibly equal

8. Predicates that create new predicates.

9. Pointers and Binary Trees!

10. Binary trees in gawk

11. Binary tree

12. Binary Trees - SmallTalk

 

 
Powered by phpBB® Forum Software