Logo

Programming-Idioms

History of Idiom 9 > diff from v6 to v7

Edit summary for version 7 by :

Version 6

2015-08-24, 07:16:07

Version 7

2015-09-03, 17:18:59

Idiom #9 Create a Binary Tree data structure

The structure must be recursive because left child and right child are binary trees too. A node has access to children nodes, but not to its parent.

Idiom #9 Create a Binary Tree data structure

The structure must be recursive because left child and right child are binary trees too. A node has access to children nodes, but not to its parent.

Code
Node = Struct.new(:left, :right)
parent = Node.new(Node.new, Node.new)