Logo

Programming-Idioms

History of Idiom 9 > diff from v42 to v43

Edit summary for version 43 by Raj:
[Cpp] missed a member in the struct

Version 42

2019-09-28, 06:03:51

Version 43

2019-09-30, 13:06:30

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
struct binary_tree
{
 binary_tree *left = nullptr, *right = nullptr;
};
Code
struct binary_tree
{
 int data;
 binary_tree *left = nullptr, *right = nullptr;
};