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

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

  • begin(): TreeSet.Iterator<Key>

clear

  • clear(): void

count

  • count(key: Key): number

empty

  • empty(): boolean

end

  • end(): TreeSet.Iterator<Key>

equal_range

  • equal_range(key: Key): Pair<TreeSet.Iterator<Key>, TreeSet.Iterator<Key>>

erase

  • erase(key: Key): number
  • erase(pos: TreeSet.Iterator<Key>): TreeSet.Iterator<Key>
  • erase(first: TreeSet.Iterator<Key>, last: TreeSet.Iterator<Key>): TreeSet.Iterator<Key>

extract

  • extract(key: Key): Key
  • extract(it: TreeSet.Iterator<Key>): TreeSet.Iterator<Key>

find

  • find(key: Key): TreeSet.Iterator<Key>

has

  • has(key: Key): boolean

insert

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

    Parameters

    • key: Key

      Key to insert.

    Returns Pair<TreeSet.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: TreeSet.Iterator<Key>

      Hint for the position where the element can be inserted.

    • key: Key

    Returns TreeSet.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

  • lower_bound(key: Key): TreeSet.Iterator<Key>

merge

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

push

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

rbegin

  • rbegin(): TreeSet.ReverseIterator<Key>

rend

  • rend(): TreeSet.ReverseIterator<Key>

size

  • size(): number

swap

toJSON

  • toJSON(): Array<Key>

upper_bound

  • upper_bound(key: Key): TreeSet.Iterator<Key>

value_comp

  • value_comp(): Comparator<Key>

Generated using TypeDoc