Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TreeSet<Key>

Unique-key Set based on Tree.

author

Jeongho Nam - https://github.com/samchon

Type parameters

  • Key

Hierarchy

Implements

Index

Type aliases

Static Iterator

Iterator<Key>: Iterator<Key, true, TreeSet<Key>>

Iterator of TreeSet

Type parameters

  • Key

Static ReverseIterator

ReverseIterator<Key>: ReverseIterator<Key, true, TreeSet<Key>>

Reverse iterator of TreeSet

Type parameters

  • Key

Constructors

constructor

  • Default Constructor.

    Parameters

    • Optional comp: Comparator<Key>

      A binary function predicates x element would be placed before y. When returns true, then x precedes y. Note that, because equality is predicated by !comp(x, y) && !comp(y, x), the function must not cover the equality like <= or >=. It must exclude the equality like < or >. Default is less.

    Returns TreeSet

  • Initializer Constructor.

    Parameters

    • items: Key[]

      Items to assign.

    • Optional comp: Comparator<Key>

      A binary function predicates x element would be placed before y. When returns true, then x precedes y. Note that, because equality is predicated by !comp(x, y) && !comp(y, x), the function must not cover the equality like <= or >=. It must exclude the equality like < or >. Default is less.

    Returns TreeSet

  • Copy Constructor.

    Parameters

    Returns TreeSet

  • Range Constructor.

    Parameters

    • first: Readonly<IForwardIterator<Key>>

      Input iterator of the first position.

    • last: Readonly<IForwardIterator<Key>>

      Input iterator of the last position.

    • Optional comp: Comparator<Key>

      A binary function predicates x element would be placed before y. When returns true, then x precedes y. Note that, because equality is predicated by !comp(x, y) && !comp(y, x), the function must not cover the equality like <= or >=. It must exclude the equality like < or >. Default is less.

    Returns TreeSet

Methods

[Symbol.iterator]

  • [Symbol.iterator](): IterableIterator<Key>

assign

  • assign<InputIterator>(first: InputIterator, last: InputIterator): void

begin

clear

  • clear(): void

count

  • count(key: Key): number

empty

  • empty(): boolean

end

equal_range

erase

extract

find

has

  • has(key: Key): boolean

insert

  • insert(key: Key): Pair<Iterator<Key>, boolean>
  • insert(hint: Iterator<Key>, key: Key): Iterator<Key>
  • insert<InputIterator>(first: InputIterator, last: InputIterator): void
  • Insert an element.

    Parameters

    • key: Key

      Key to insert.

    Returns Pair<Iterator<Key>, boolean>

    Pair of an iterator to the newly inserted element and true, if the specified key doesn't exist, otherwise Pair of iterator to ordinary element and false.

  • Insert an element with hint.

    Parameters

    • hint: Iterator<Key>

      Hint for the position where the element can be inserted.

    • key: Key

    Returns Iterator<Key>

    An iterator to the newly inserted element, if the specified key doesn't exist, otherwise an iterator to the ordinary element.

  • Insert range elements.

    Type parameters

    Parameters

    • first: InputIterator

      Input iterator of the first position.

    • last: InputIterator

      Input iteartor of the last position.

    Returns void

key_comp

  • key_comp(): Comparator<Key>

lower_bound

merge

  • merge(source: TreeSet<Key>): void

push

  • push(...items: Key[]): number

rbegin

rend

size

  • size(): number

swap

toJSON

  • toJSON(): Array<Key>

upper_bound

value_comp

  • value_comp(): Comparator<Key>

Generated using TypeDoc