The numbers we were given are (19 (13 (10 () 12) 15) (24 (22 20 ()) (31 27 39))). This represent a BST as

19

13 24

10 15 22 31

nil 12 nilnil 20nil 27 39

Any insight to what is going wrong with my Find_max function? Also the start function will intiialize the above list to the variable a.

;Data for the BST (defun start() (setq a '(19 (13 (10 () 12) 15) (24 (22 20 ()) (31 27 39))) )) ; Return Base Node (defun get_value (x) (first x)) ; Return Left Subtree (defun left_subtree(x) (first (rest x))) ;Return Right Subtree (defun right_subtree(x) (rest (rest x))) ;Finds min value recursively (defun find_min (x) (print x) (cond ;Return Atom if found, Will be min ((atom x) x ) ;Empty List ((null x) nil ) ;Return Min List ((null (first( rest x))) (first x) ) ;Continue Left ( t (find_min(first(rest x))) ) ) ) ;Finds max value recursviely (defun find_max (x) (print x) (cond ;Return Atom if found, Will be max ((atom x) x ) ;Empty List ((null x) nil ) ;Return Max (last element) ((null (rest x)) x ) ; Continue Right ( t (find_max(rest(rest x))) ) ) ) ;Inorder (defun inorder (x) (cond ;Root = NULL ((atom x) x ) ((null (rest x)) x ) ;Left ( t (inorder (rest(first x))) ) ;Print/Store ( t (print x) ) ;Right ( t (inorder (rest (rest x))) ) ) )