module BinaryTree(T, Node, NilNode)

Included Modules

Direct including types

Defined in:

datastructure/binary_tree.cr

Instance Method Summary

Instance methods inherited from module Enumerable(T)

accumulate(init : U) : Array(U) forall U
accumulate : Array(T)
accumulate(init : U, &block : U, T -> U) : Array(U) forall U
accumulate(&block : T, T -> T) : Array(T)
accumulate
, mex : T mex, mex_sorted : T mex_sorted, tally(*, default : Int32) : Hash(T, Int32) tally, unique : self
unique(&) : self
unique

Instance Method Detail

def <<(key : T) : self #

[View source]
def add(key : T) : self #

[View source]
abstract def add?(key : T) : Bool #

[View source]
def clear : self #

[View source]
abstract def delete(key : T) : Bool #

[View source]
def each(node : Node = min_node) #
Description copied from module Iterable(T)

Must return an Iterator over the elements in this collection.


[View source]
def each(node : Node = min_node, &) : Nil #
Description copied from module Enumerable(T)

Must yield this collection's elements to the block.


[View source]
def empty? : Bool #

[View source]
def ge(key : T) : T? #

[View source]
def ge!(key : T) : T #

[View source]
def ge_node(key : T, x : Node = root) : Node #

[View source]
def gt(key : T) : T? #

[View source]
def gt!(key : T) : T #

[View source]
def gt_node(key : T, x : Node = root) : Node #

[View source]
def includes?(key : T) : Bool #

[View source]
def le(key : T) : T? #

[View source]
def le!(key : T) : T #

[View source]
def le_node(key : T, x : Node = root) : Node #

[View source]
def lt(key : T) : T? #

[View source]
def lt!(key : T) : T #

[View source]
def lt_node(key : T, x : Node = root) : Node #

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

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 max? : T? #
Description copied from module Enumerable(T)

Like #max but returns nil if the collection is empty.


[View source]
def max_node : Node #

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

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 min? : T? #
Description copied from module Enumerable(T)

Like #min but returns nil if the collection is empty.


[View source]
def min_node : Node #

[View source]
def reverse_each(node : Node = max_node) #

[View source]
def reverse_each(node : Node = max_node, &) : Nil #

[View source]
abstract def root #

[View source]
def rotate_left(x : Node) : Nil #

[View source]
def rotate_right(x : Node) : Nil #

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

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

Returns the number of elements in the collection.

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

[View source]