tree in-order

Discussion of Common Lisp

tree in-order

Postby 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
doot
 
Posts: 2
Joined: Sat Dec 17, 2011 5:16 am

Re: tree in-order

Postby Konfusius » Mon Dec 19, 2011 4:17 pm

Just reorder the arguments to append.
Konfusius
 
Posts: 62
Joined: Fri Jun 10, 2011 6:38 am


Return to Common Lisp

Who is online

Users browsing this forum: Google [Bot] and 3 guests