let in_order tree = let rec aux tree accumulator = match tree with | Nil -> accumulator |Member (left, value, right) -> let acc_with_right = aux right accumulator in let acc_with_value = value :: acc_with_right in aux left acc_with_value in aux tree []给大家分享一下一个Ocaml 写 中序遍历的写法,中序遍历是左中右。
全部评论
(0) 回帖