Logo

Programming-Idioms

History of Idiom 9 > diff from v2 to v3

Edit summary for version 3 by :

Version 2

2015-08-21, 08:00:28

Version 3

2015-08-22, 21:08:06

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 his 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 his parent.

Code
struct BinTree<T> {
    value: T
    left: Option<Box<BinTree<T>>>,
    right: Option<Box<BinTree<T>>>,
}