Logo

Programming-Idioms

History of Idiom 17 > diff from v37 to v38

Edit summary for version 38 by Lynx:
New Scala implementation by user [Lynx]

Version 37

2019-01-23, 17:35:06

Version 38

2019-09-26, 15:00:31

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
case class Node[T](value: T, children: List[Node[T]] = Nil)