Pass the function below through this Binary Tree:
let rec inorder(t:tree) : int list =
begin match t with
| Empty -> []
| Node (left, x, right) -> inorder left @ (x :: inorder right)
end
Why is the result [1;2;3;4;5;6;7] and not [1;2;3;4;5;7;6] ?
Well, 7 does come before 6 in the tree diagram you linked to.
What does the actual data look like that is passed to the inorder
function?