Class: LeftLeaningRedBlackTree::NullNode

Inherits:
TreeNode
  • Object
show all
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

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

#initializeNullNode

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_levelObject



13
14
15
# File 'lib/left_leaning_red_black_tree/null_node.rb', line 13

def max_level
  0
end

#null?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/left_leaning_red_black_tree/null_node.rb', line 9

def null?
  true
end