Prolog binary tree node value count -
Can anyone help me in Prolog How can the plant be realized that all the node numbers of the binary tree count goes?
For example:
tree 1 (tree (1, tree (2, tree (3, zero, zero), tree (4, zero, zero)) , Tree (5, tree (6, zero, zero), tree (7, zero, zero)). will return 28. Can anybody help?
Tail-recursive not short resuscitation. < Tree> tree (zero, 0) tree (tree (X, T1, T2), S): - Perum (T1, S1), tree (T2, S2), SX + S1 + S 2.
Comments
Post a Comment