Class: TreeNode
- Inherits:
-
Object
- Object
- TreeNode
- Defined in:
- lib/binary_trees.rb
Instance Attribute Summary collapse
-
#left ⇒ Object
Returns the value of attribute left.
-
#right ⇒ Object
Returns the value of attribute right.
-
#val ⇒ Object
Returns the value of attribute val.
Instance Method Summary collapse
-
#initialize(val = 0, left = nil, right = nil) ⇒ TreeNode
constructor
A new instance of TreeNode.
Constructor Details
#initialize(val = 0, left = nil, right = nil) ⇒ TreeNode
Returns a new instance of TreeNode.
16 17 18 19 20 |
# File 'lib/binary_trees.rb', line 16 def initialize(val = 0, left = nil, right = nil) @val = val @left = left @right = right end |
Instance Attribute Details
#left ⇒ Object
Returns the value of attribute left.
14 15 16 |
# File 'lib/binary_trees.rb', line 14 def left @left end |
#right ⇒ Object
Returns the value of attribute right.
14 15 16 |
# File 'lib/binary_trees.rb', line 14 def right @right end |
#val ⇒ Object
Returns the value of attribute val.
14 15 16 |
# File 'lib/binary_trees.rb', line 14 def val @val end |