Question: (Prolog) We represent a node of a binary tree with node(L, R, K) where L is the left subtree, R is the right subtree, and
(Prolog) We represent a node of a binary tree with node(L, R, K) where L is the left subtree, R is the right subtree, and K is the stored integer key. We use nil to represent an empty tree. Write a predicate nodeCount(1, [Ne, Ni, N2] that is true if T is a binary tree as defined above, NO is the number of nodes of T with O children, N1 is the number of nodes of Twith child, and N2 is the number of nodes of Twith 2 children
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
