class SMultiSet::Bucket(T, BUCKET_RATIO, REBUILD_RATIO, BSEARCH)
- SMultiSet::Bucket(T, BUCKET_RATIO, REBUILD_RATIO, BSEARCH)
- Reference
- Object
Overview
reference: https://github.com/tatyam-prime/SortedSet/blob/main/SortedSet.py
Included Modules
- Enumerable(T)
- Indexable(T)
- Iterable(T)
Defined in:
datastructure/smultiset/bucket.crConstructors
Instance Method Summary
- #&(other : Enumerable(T)) : self
- #+(other : Enumerable(T)) : self
- #-(other : Enumerable(T)) : self
- #<<(object : T) : self
- #^(other : Enumerable(T)) : self
- #add(object : T) : self
- #clear
- #concat(elems) : self
- #count(object : T) : Int32?
- #delete(object : T) : Bool
-
#each
Returns an
Iteratorfor the elements ofself. -
#each(&) : Nil
Calls the given block once for each element in
self, passing that element as a parameter. -
#empty? : Bool
Returns
trueifselfis empty,falseotherwise. - #ge(object : T) : T?
- #ge!(object : T) : T
- #gt(object : T) : T?
- #gt!(object : T) : T
- #includes?(object : T) : Bool
- #index(object : T) : Int32?
- #index_left(object : T) : Int32
- #index_right(object : T) : Int32?
-
#inspect(io : IO) : Nil
Appends a String representation of this object which includes its class name, its object address and the values of all instance variables.
- #le(object : T) : T?
- #le!(object : T) : T
- #lt(object : T) : T?
- #lt!(object : T) : T
-
#max : T
Returns the element with the maximum value in the collection.
-
#max? : T?
Like
#maxbut returnsnilif the collection is empty. -
#min : T
Returns the element with the minimum value in the collection.
-
#min? : T?
Like
#minbut returnsnilif the collection is empty. -
#reverse_each(&) : Nil
Same as
#each, but works in reverse. -
#size
Returns the number of elements in this container.
-
#to_a : Array(T)
Returns an
Arraywith all the elements in the collection. -
#to_s(io : IO) : Nil
Appends a short String representation of this object which includes its class name and its object address.
-
#unsafe_fetch(index : Int) : T
Returns the element at the given index, without doing any bounds check.
- #|(other : Enumerable(T)) : self
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 Uaccumulate : 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 Uaccumulate : 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
Instance Method Detail
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.
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 --
Returns true if self is empty, false otherwise.
([] of Int32).empty? # => true
([1]).empty? # => false
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>
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.
Like #max but returns nil if the collection is empty.
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.
Like #min but returns nil if the collection is empty.
Same as #each, but works in reverse.
Returns the number of elements in this container.
Returns an Array with all the elements in the collection.
{1, 2, 3}.to_a # => [1, 2, 3]
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>
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.