class

AtCoder::RedBlackTree

Inherits Enumerable / Reference / Object

Constructors

Instance methods

<<(x)
Source
black_height(x = root)
Source
delete(key)
Source
delete_node(z)
Source
each(x = root, &)

Must yield this collection's elements to the block.

Source
empty?

Returns true if self does not contain any element.

([] of Int32).empty? # => true
([1]).empty?         # => false
[nil, false].empty?  # => false
  • #present? returns the inverse.
Source
has_key?(key)
Source
inorder_walk(x = root, &)
Source
insert(key)
Source
insert_node(x)
Source
lower_than(key, x = root)
Source
max

Returns the element with the maximum value in the collection.

It compares using > so it will work for any type that supports that method.

[1, 2, 3].max        # => 3
["Alice", "Bob"].max # => "Bob"

Raises Enumerable::EmptyError if the collection is empty.

Source
maximum_node(x = root)
Source
min

Returns the element with the minimum value in the collection.

It compares using < so it will work for any type that supports that method.

[1, 2, 3].min        # => 1
["Alice", "Bob"].min # => "Alice"

Raises Enumerable::EmptyError if the collection is empty.

Source
minimum_node(x = root)
Source
predecessor(x)
Source
reverse_each(x = root, &)
Source
reverse_inorder_walk(x = root, &)
Source
root
Source
root=(root : Node)
Source
search(key, x = root)
Source
size

Returns the number of elements in the collection.

[1, 2, 3, 4].size # => 4
Source
size=(size : Int32)
Source
successor(x)
Source

Nested types