Logo

Programming-Idioms

History of Idiom 9 > diff from v35 to v36

Edit summary for version 36 by roryg:
New Caml implementation by user [roryg]

Version 35

2019-09-26, 20:28:07

Version 36

2019-09-26, 23:15:58

Idiom #9 Create a Binary Tree data structure

The structure must be recursive because left child and right child are binary trees too. A node has access to children nodes, but not to its parent.

Idiom #9 Create a Binary Tree data structure

The structure must be recursive because left child and right child are binary trees too. A node has access to children nodes, but not to its parent.

Code
type treenode =
    Node of {
        value: int;
        left: treenode;
        right: treenode
    }
    | Leaf