2017-03-11 108 views
0

通行证下面的功能,通过此Binary TreeOCaml的二叉树

let rec inorder(t:tree) : int list = 
    begin match t with 
    | Empty -> [] 
    | Node (left, x, right) -> inorder left @ (x :: inorder right) 
    end 

为什么结果[1; 2; 3; 4; 5; 6; 7]和不[1; 2; 3; 4 ; 5; 7; 6]?

回答

0

那么,7确实在你链接的树形图中出现在6之前。

实际数据看起来像什么传递给inorder函数?

+0

树实际上是在一个问题集中给出 - 也许答案的关键是错误的,然后 – user