Logo

Programming-Idioms

History of Idiom 17 > diff from v17 to v18

Edit summary for version 18 by :
New Csharp implementation by user [Marti_2203]

Version 17

2016-02-18, 16:57:57

Version 18

2016-02-20, 17:39:11

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.

Imports
using System.Collections.Generic
Code
class Node<T>
{
 T value;
 List<Node<T>> childNodes
}
Comments bubble
The Children can be stored in an Array or List, depending on how you want to implement it.