class AtCoder::RedBlackTree

Included Modules

Defined in:

red_black_tree.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new #

[View source]

Instance Method Detail

def <<(x) #

[View source]
def black_height(x = root) #

[View source]
def delete(key) #

[View source]
def delete_node(z) #

[View source]
def each(x = root, &) #
Description copied from module Enumerable(Int32)

Must yield this collection's elements to the block.


[View source]
def empty? #
Description copied from module Enumerable(Int32)

Returns true if self is empty, false otherwise.

([] of Int32).empty? # => true
([1]).empty?         # => false

[View source]
def has_key?(key) #

[View source]
def inorder_walk(x = root, &) #

[View source]
def insert(key) #

[View source]
def insert_node(x) #

[View source]
def lower_than(key, x = root) #

[View source]
def max #
Description copied from module Enumerable(Int32)

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.


[View source]
def maximum_node(x = root) #

[View source]
def min #
Description copied from module Enumerable(Int32)

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.


[View source]
def minimum_node(x = root) #

[View source]
def predecessor(x) #

[View source]
def reverse_each(x = root, &) #

[View source]
def reverse_inorder_walk(x = root, &) #

[View source]
def root : Node #

[View source]
def root=(root : Node) #

[View source]
def search(key, x = root) #

[View source]
def size : Int32 #
Description copied from module Enumerable(Int32)

Returns the number of elements in the collection.

[1, 2, 3, 4].size # => 4

[View source]
def size=(size : Int32) #

[View source]
def successor(x) #

[View source]