Logo

Programming-Idioms

History of Idiom 9 > diff from v28 to v29

Edit summary for version 29 by 1.7.4:
New JS implementation by user [1.7.4]

Version 28

2018-04-03, 08:21:39

Version 29

2019-01-23, 17:28:24

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
class Node {
  constructor (data,) {
    this.data = data
    this.left = null
    this.right = null
  }
}