Class: BinaryTreeNode

Inherits:
Object
  • Object
show all
Defined in:
lib/data_structures/binary_tree.rb

Instance Method Summary collapse

Constructor Details

#initialize(val = nil, parent = nil, left_child = nil, right_child = nil) ⇒ BinaryTreeNode

Returns a new instance of BinaryTreeNode.



69
70
71
72
73
74
# File 'lib/data_structures/binary_tree.rb', line 69

def initialize(val=nil, parent=nil, left_child=nil, right_child=nil)
  @val = val
  @parent = parent
  @left_child = left_child
  @right_child = right_child
end

Instance Method Details

#inspectObject



80
81
82
# File 'lib/data_structures/binary_tree.rb', line 80

def inspect
  @val
end

#to_sObject



76
77
78
# File 'lib/data_structures/binary_tree.rb', line 76

def to_s
  @val
end