class SMultiSet::Bucket(T, BUCKET_RATIO, REBUILD_RATIO, BSEARCH)

Overview

reference: https://github.com/tatyam-prime/SortedSet/blob/main/SortedSet.py

Included Modules

Defined in:

datastructure/smultiset/bucket.cr

Constructors

Instance Method Summary

Instance methods inherited from module Indexable(T)

[](point : Point) [], []?(point : Point) []?, each_pair(&)
each_pair
each_pair
, fetch(point : Point, &) fetch

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 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(a : Enumerable(T)) #

[View source]
def self.new #

[View source]

Instance Method Detail

def &(other : Enumerable(T)) : self #

[View source]
def +(other : Enumerable(T)) : self #

[View source]
def -(other : Enumerable(T)) : self #

[View source]
def <<(object : T) : self #

[View source]
def ^(other : Enumerable(T)) : self #

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

[View source]
def clear #

[View source]
def concat(elems) : self #

[View source]
def count(object : T) : Int32? #

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

[View source]
def each #
Description copied from module Indexable(T)

Returns an Iterator for the elements of self.

a = ["a", "b", "c"]
iter = a.each
iter.next # => "a"
iter.next # => "b"

The returned iterator keeps a reference to self: if the array changes, the returned values of the iterator change as well.


[View source]
def each(&) : Nil #
Description copied from module Indexable(T)

Calls the given block once for each element in self, passing that element as a parameter.

a = ["a", "b", "c"]
a.each { |x| print x, " -- " }

produces:

a -- b -- c --

[View source]
def empty? : Bool #
Description copied from module Indexable(T)

Returns true if self is empty, false otherwise.

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

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

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

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

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

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

[View source]
def index(object : T) : Int32? #

[View source]
def index_left(object : T) : Int32 #

[View source]
def index_right(object : T) : Int32? #

[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]
def le(object : T) : T? #

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

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

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

[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 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 reverse_each(&) : Nil #
Description copied from module Indexable(T)

Same as #each, but works in reverse.


[View source]
def size #
Description copied from module Indexable(T)

Returns the number of elements in this container.


[View source]
def to_a : Array(T) #
Description copied from module Indexable(T)

Returns an Array with all the elements in the collection.

{1, 2, 3}.to_a # => [1, 2, 3]

[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]
def unsafe_fetch(index : Int) : T #
Description copied from module Indexable(T)

Returns the element at the given index, without doing any bounds check.

Indexable makes sure to invoke this method with index in 0...size, so converting negative indices to positive ones is not needed here.

Clients never invoke this method directly. Instead, they access elements with #[](index) and #[]?(index).

This method should only be directly invoked if you are absolutely sure the index is in bounds, to avoid a bounds check for a small boost of performance.


[View source]
def |(other : Enumerable(T)) : self #

[View source]