TreapOfInt extension type

A persistent treap implementation using immutable nodes.

Provides efficient insertion, deletion, and lookup operations (O(log N)).

on
Implemented types

Constructors

TreapOfInt.of(Iterable<int> items, [Comparator<int>? compare])
Creates a Treap containing the items.

Properties

base → TreapBase<int, IntNode>
final
compare → Comparator<int>
The Comparator used to determine element order.
finalinherited
first → int
The first item in the sorted sequence.
no setterinherited
firstOrDefault → int?
The first item in the sorted sequence, or null if this treap is empty.
no setterinherited
hashCode → int
The hash code for this object.
no setterinherited
isEmpty → bool
Whether this treap is empty.
no setterinherited
last → int
The last item in the sorted sequence.
no setterinherited
lastOrDefault → int?
The last item in the sorted sequence, or null if this treap is empty.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
size → int
The number of items in this treap.
no setterinherited
values → Iterable<int>
An Iterable of the items in this treap in ascending order according to compare.
no setterinherited

Methods

add(int item) → TreapOfInt
Adds an item to this treap.
addAll(Iterable<int> items) → TreapOfInt
Adds all items to this treap.
addOrUpdate(int item) → TreapOfInt
Adds or updates an item in this treap.
copy() → TreapOfInt
Returns a copy of this treap.
difference(TreapOfInt other) → TreapOfInt
Returns the difference of this treap minus other.
find(int item) → int?
Finds the item in this treap equal to item.
inherited
has(int item) → bool
Whether this treap contains an item equal to item.
inherited
intersection(TreapOfInt other) → TreapOfInt
Returns the intersection of this treap and other.
next(int item) → int
Returns the item succeeding item in the sorted sequence.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
prev(int item) → int
Returns the item preceding item in the sorted sequence.
inherited
rank(int item) → int
Returns the rank of item in the sorted sequence of items.
inherited
remove(int item) → TreapOfInt
Removes an item from this treap.
select(int index) → int
Returns the item at the given index in the sorted sequence.
inherited
skip(int count) → TreapOfInt
Returns a new treap skipping the first count items.
take(int count) → TreapOfInt
Returns a new treap containing the first count items.
toString() → String
A string representation of this object.
inherited
union(TreapOfInt other) → TreapOfInt
Returns the union of this treap and other.

Operators

operator &(TreapBase<int, IntNode> other) → TreapBase<int, IntNode>
Operator overload for the intersection of two treaps.
inherited
operator +(int item) → TreapBase<int, IntNode>
Operator overload for adding an item to the treap.
inherited
operator -(TreapBase<int, IntNode> other) → TreapBase<int, IntNode>
Operator overload for the difference of two treaps.
inherited
operator ==(Object other) → bool
The equality operator.
inherited
operator [](int index) → int
Operator overload for selecting an item in the treap by its index.
inherited
operator |(TreapBase<int, IntNode> other) → TreapBase<int, IntNode>
Operator overload for the union of two treaps.
inherited