Class: LeftLeaningRedBlackTree::NullNode
- Defined in:
- lib/left_leaning_red_black_tree/null_node.rb
Instance Attribute Summary
Attributes inherited from TreeNode
#color, #key, #left, #payload, #right
Instance Method Summary collapse
-
#initialize ⇒ NullNode
constructor
A new instance of NullNode.
- #insert(key, payload) ⇒ Object
- #max_level ⇒ Object
- #null? ⇒ Boolean
Methods inherited from TreeNode
#black?, #delete, #delete_min, #fix_up, #flip_colors, #min_node, #move_red_left, #move_red_right, #red?, #rotate_left, #rotate_right, #to_a
Methods included from Printable
#all_elements_nil?, #print_node, #print_white_spaces
Constructor Details
#initialize ⇒ NullNode
Returns a new instance of NullNode.
4 5 6 7 |
# File 'lib/left_leaning_red_black_tree/null_node.rb', line 4 def initialize super(nil) @color = BLACK end |
Instance Method Details
#insert(key, payload) ⇒ Object
17 18 19 |
# File 'lib/left_leaning_red_black_tree/null_node.rb', line 17 def insert(key, payload) TreeNode.new(key, payload) end |
#max_level ⇒ Object
13 14 15 |
# File 'lib/left_leaning_red_black_tree/null_node.rb', line 13 def max_level 0 end |
#null? ⇒ Boolean
9 10 11 |
# File 'lib/left_leaning_red_black_tree/null_node.rb', line 9 def null? true end |