Logo

Programming-Idioms

History of Idiom 17 > diff from v2 to v3

Edit summary for version 3 by :

Version 2

2015-08-20, 15:44:53

Version 3

2015-08-20, 15:45:34

Idiom #17 Create a Tree data structure

The structure must be recursive. A node may have zero or more children. A node has access to children nodes, but not to his parent.

Idiom #17 Create a Tree data structure

The structure must be recursive. A node may have zero or more children. A node has access to children nodes, but not to his parent.

Code
struct Node(T){
    Node!T[] children;
    T data;
}
Code
struct Node(T){
    Node!T[] children;
    T data;
}

alias IntTree = Node!(int);