Logo

Programming-Idioms

History of Idiom 17 > diff from v30 to v31

Edit summary for version 31 by sphinxc0re:
New Rust implementation by user [sphinxc0re]

Version 30

2016-12-04, 21:43:01

Version 31

2016-12-13, 20:58:15

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
struct Node<T> {
  value: T,
  children: Vec<Node<T>>,
}