Logo

Programming-Idioms

History of Idiom 17 > diff from v45 to v46

Edit summary for version 46 by tkoenig:
[Fortran] Fixed typo.

Version 45

2019-09-29, 15:14:48

Version 46

2019-09-29, 15:38:22

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
type node_t
  integer:: value
  type(node_s), pointer :: next_sibling;
  type(node_s), pointer :: first_child;
end type node_t
Code
type node_t
  integer:: value
  type(node_t), pointer :: next_sibling;
  type(node_t), pointer :: first_child;
end type node_t