Skip to content

Instantly share code, notes, and snippets.

@boldijar
Created January 10, 2017 20:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save boldijar/6a910ac3fc2982032f5ac7f8f4daf30b to your computer and use it in GitHub Desktop.
Save boldijar/6a910ac3fc2982032f5ac7f8f4daf30b to your computer and use it in GitHub Desktop.
(defun preordine(l)
(cond
( ( null l ) nil )
( t
(
append
( list ( car l ) )
( preordine ( cadr l ) )
( preordine ( caddr l ))
)
)
)
)
(defun postordine(l)
(cond
( ( null l ) nil )
( t
(
append
( postordine ( cadr l ) )
( postordine ( caddr l ))
( list ( car l ) )
)
)
)
)
(defun inordine(l)
(cond
( ( null l ) nil )
( t
(
append
( inordine ( cadr l ) )
( list ( car l ) )
( inordine ( caddr l ))
)
)
)
)
;adancimea unui arbore
(defun adancime(l)
( cond
( ( null ( cdr l ) ) 0 )
( t ( + 1
( max ( adancime ( cadr l ) ) ( adancime ( caddr l ) ) )
)
)
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment