Logo

Programming-Idioms

History of Idiom 17 > diff from v31 to v32

Edit summary for version 32 by Dodopod:
New C implementation by user [Dodopod]

Version 31

2016-12-13, 20:58:15

Version 32

2017-05-27, 20:12:09

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

Code
typedef struct node_s
{
    int value;
    struct node_s *nextSibling;
    struct node_s *firstChild;
} node_t;