Can anyone help me how to realize predicate in Prolog which counts the all the node numbers of a binary tree?
For example:
tree1(tree(1,
tree(2,
tree(3,nil,nil),
tree(4,nil,nil)),
tree(5,
tree(6,nil,nil),
tree(7,nil,nil))
)
).
Would return 28. Anyone can help?