[Pts 2]
Consider the standard way of representing trees in logic programming,
and the following definition of a predicate p:
p(empty,[]).
p(node(T1,X,T2),L) :-
p(T1,L1), p(T2,L2), append(L1,L2,K), append(K,[X],L).
/* append is the predefined list concatenation */
Consider now the query ?-p(t,L). where t is a term representing a certain tree.
What is the result returned by it? (only one answer, please)
- L is the list of all the internal nodes of t
- L is the list of all the nodes in the frontier of t
- L is the list of all the nodes of t according to the preorder traversal
- L is the list of all the nodes of t according
to the postorder traversal