Logo

Programming-Idioms

History of Idiom 9 > diff from v16 to v17

Edit summary for version 17 by :
New Python implementation by user [TinyFawks]

Version 16

2016-02-16, 17:09:30

Version 17

2016-02-16, 19:42:12

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:
	def __init__(self, data):
		self.data = data
		self.left = None
		self.right = None
Demo URL
http://codepad.org/MXXPa9bQ