class SMultiSet::RedBlackTree(T)

Overview

Copied with modifications from: https://github.com/crystal-lang/crystal/blob/1.1.1/samples/red_black_tree.cr

Included Modules

Defined in:

datastructure/smultiset/red_black_tree.cr

Constructors

Instance Method Summary

Instance methods inherited from module BinaryTree(T, SMultiSet::RedBlackTree::Node(T), SMultiSet::RedBlackTree::NilNode(T))

<<(key : T) : self <<, add(key : T) : self add, add?(key : T) : Bool add?, clear : self clear, delete(key : T) : Bool delete, each(node : Node(T) = min_node)
each(node : Node(T) = min_node, &) : Nil
each
, empty? : Bool empty?, ge(key : T) : T? ge, ge!(key : T) : T ge!, ge_node(key : T, x : Node(T) = root) : Node(T) ge_node, gt(key : T) : T? gt, gt!(key : T) : T gt!, gt_node(key : T, x : Node(T) = root) : Node(T) gt_node, includes?(key : T) : Bool includes?, le(key : T) : T? le, le!(key : T) : T le!, le_node(key : T, x : Node(T) = root) : Node(T) le_node, lt(key : T) : T? lt, lt!(key : T) : T lt!, lt_node(key : T, x : Node(T) = root) : Node(T) lt_node, max : T max, max? : T? max?, max_node : Node(T) max_node, min : T min, min? : T? min?, min_node : Node(T) min_node, reverse_each(node : Node(T) = max_node)
reverse_each(node : Node(T) = max_node, &) : Nil
reverse_each
, root root, rotate_left(x : Node(T)) : Nil rotate_left, rotate_right(x : Node(T)) : Nil rotate_right, search(key : T, x : Node(T) = root) : Node(T) search, size : Int32 size

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

Constructor Detail

def self.new(enumerable : Enumerable(T)) #

[View source]
def self.new #

[View source]

Instance Method Detail

def add?(key : T) : Bool #

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

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

[View source]
def inspect(io : IO) : Nil #
Description copied from class Reference

Appends a String representation of this object which includes its class name, its object address and the values of all instance variables.

class Person
  def initialize(@name : String, @age : Int32)
  end
end

Person.new("John", 32).inspect # => #<Person:0x10fd31f20 @name="John", @age=32>

[View source]

[View source]
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]
def split(key : T) : Tuple(self, self) #

[View source]
def to_s(io : IO) : Nil #
Description copied from class Reference

Appends a short String representation of this object which includes its class name and its object address.

class Person
  def initialize(@name : String, @age : Int32)
  end
end

Person.new("John", 32).to_s # => #<Person:0x10a199f20>

[View source]