Code: Select all

```
(defun search1 (a)
(if (listp temp) (and (setq node (car temp))
(setq left (cadr temp)) (setq right (caddr temp))))
(if (listp node)
(setq node1 (car node)) (setq node1 node))
(cond ((= a node1) (and (setq temp input) (= 1 1)))
((> a node1) (and (setq temp right)
(if (atom temp)(if (= temp a) (and (setq temp input) (= 1 1)) (and (setq temp input) (= 1 2))) (search1 a))))
((< a node1) (and (setq temp left)
(if (atom temp)(if (= temp a) (and (setq temp input) (= 1 1)) (and (setq temp input) (= 1 2))) (search1 a))))))
(defun search (a)
(setq temp input)
(if (= 1 1) (search1 a)))
```

It's totally fine when the input is (5 4 (9 7 10)).

I hv struggled with this problem for 5 hours, pleae help!!