tree in-order

Discussion of Common Lisp
Post Reply
doot
Posts: 2
Joined: Sat Dec 17, 2011 5:16 am

tree in-order

Post by doot » Sat Dec 17, 2011 5:26 am

I have a tree of type (2)
A
/ \
B C
/ \
D E

I have this function which returns my nods in post-order
(defun postordine(l)
(cond
((null l) l)
(t (append (postordine (car (cdr l))) (postordine (car (cdr (cdr l)))) (list(car l))))
)
)


I need to change it for a in-order
any help ? :] or link to some tutorials

Konfusius
Posts: 62
Joined: Fri Jun 10, 2011 6:38 am

Re: tree in-order

Post by Konfusius » Mon Dec 19, 2011 4:17 pm

Just reorder the arguments to append.

Post Reply