Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Deque<T>

Double ended queue.

author

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

Type parameters

  • T

Hierarchy

Implements

Index

Type aliases

Static Iterator

Iterator<T>: ArrayIterator<T, Deque<T>>

Iterator of Deque

Type parameters

  • T

Static ReverseIterator

ReverseIterator<T>: ArrayReverseIterator<T, Deque<T>>

Reverse iterator of Deque

Type parameters

  • T

Constructors

constructor

Properties

Static MAGNIFIER

MAGNIFIER: 1.5 = 1.5

Expansion ratio.

Static MIN_CAPACITY

MIN_CAPACITY: 36 = 36

Minimum Deque.capacity.

Although a Deque has few elements, even no element is belonged to, the Deque keeps the minimum Deque.capacity at least.

Static ROW_SIZE

ROW_SIZE: 8 = 8

Row size of the {@link Deque.matrix_ matrix} which contains elements.

Note that the ROW_SIZE affects on time complexity of accessing and inserting element. Accessing element is ROW_SIZE times slower than ordinary Vector and inserting element in middle position is ROW_SIZE times faster than ordinary Vector.

When the ROW_SIZE returns 8, time complexity of accessing element is O(8) and inserting element in middle position is O(N/8). (Vector's time complexity of accessement is O(1) and inserting element is O(N)).

Methods

[Symbol.iterator]

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

assign

  • assign(n: number, val: T): void
  • assign<InputIterator>(first: InputIterator, last: InputIterator): void

at

  • at(index: number): T

back

  • back(): T
  • back(val: T): void

begin

capacity

  • capacity(): number

clear

  • clear(): void

empty

  • empty(): boolean

end

erase

front

  • front(): T
  • front(val: T): void

insert

nth

pop_back

  • pop_back(): void

pop_front

  • pop_front(): void

push

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

push_back

  • push_back(val: T): void

push_front

  • push_front(val: T): void

rbegin

rend

reserve

  • reserve(n: number): void

resize

  • resize(n: number): void

set

  • set(index: number, val: T): void

shrink_to_fit

  • shrink_to_fit(): void

size

  • size(): number

swap

  • swap(obj: Deque<T>): void

toJSON

  • toJSON(): Array<T>

Generated using TypeDoc