tree constant. Hint: you might use 'univ', or its cousins.
?- postorder(a(b,c,d(e,f,g))).
b c e f g d a true
Hi ,
I am trying this problem but , the output is undefined predicate postorder. I think i wrote correctly but, it is not working.
postorder(void,[]).
postorder(tree(X,L,R),Xs):-
postorder(L,Ls),postorder(R,Rs),append(Rs,[X],Rs1),append(Ls,Rs1,Xs).
can anyone please help me. Urgent...
Thank you.
?- postorder(a(b,c,d(e,f,g))).
b c e f g d a true
Hi ,
I am trying this problem but , the output is undefined predicate postorder. I think i wrote correctly but, it is not working.
postorder(void,[]).
postorder(tree(X,L,R),Xs):-
postorder(L,Ls),postorder(R,Rs),append(Rs,[X],Rs1),append(Ls,Rs1,Xs).
can anyone please help me. Urgent...
Thank you.