;; Chapter 14 example ;; a node of a binary search tree ;; ssn is an integer representing a social security number ;; name is a symbol representing a name ;; left and right are nodes for left and right subtree (define-struct node (ssn name left right)) ;; define the rest of the tree A (define mytree (make-node 63 'a (make-node 29 'b (make-node 15 'c (make-node 10 'd false false) (make-node 24 'e false false)) false) (make-node 89 'i false false))) mytree ;; search-bt: integer, binary tree node -> symbol/boolean ;; The function consumes a number n and a binary tree node. ;; If the tree contains a node structure whose ssn field is n, ;; the function produces the value of the name field in that node. ;; Otherwise, the function produces false. ;; inorder: binary tree node -> a list of integers ;; It consumes a binary tree and produces a list of all the ssn numbers ;; in the tree. The list contains the numbers in the left-to-right order: ;; the numbers in the left subtree, the number in the node, the ;; numbers in the right subtree