0

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] ?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
user
  • 7
  • 4

1 Answers1

0

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?

Jeffrey Scofield
  • 65,646
  • 2
  • 72
  • 108