Class: DSA::RedBlackTreeNode
Constant Summary
collapse
- RED =
0
- BLACK =
1
Instance Attribute Summary
#key, #left, #parent, #right, #value
Instance Method Summary
collapse
Constructor Details
Returns a new instance of RedBlackTreeNode.
424
425
426
427
|
# File 'lib/DSA/binary_search_tree.rb', line 424
def initialize(key, value)
super(key, value)
@color = RED
end
|
Instance Method Details
#black? ⇒ Boolean
433
434
435
|
# File 'lib/DSA/binary_search_tree.rb', line 433
def black?
@color == BLACK
end
|
#red? ⇒ Boolean
429
430
431
|
# File 'lib/DSA/binary_search_tree.rb', line 429
def red?
@color == RED
end
|
#set_black! ⇒ Object
437
438
439
|
# File 'lib/DSA/binary_search_tree.rb', line 437
def set_black!
@color = BLACK
end
|
#set_red! ⇒ Object
441
442
443
|
# File 'lib/DSA/binary_search_tree.rb', line 441
def set_red!
@color = RED
end
|