I have defined a tree like this:
type 'a btree =
| Node of ('a * 'a btree * 'a btree)
I am trying to define two functions, one that prints out every element of a tree. How do I do that when the tree can be a tree of ints but also something else like strings.
I also want to make a function that searches the tree for a specific value. Can anyone help me explain how to do this.
(* val print_tree: ('a -> unit) -> 'a btree -> unit )
( val search_tree: 'a -> 'a btree -> bool *)