deque

package
v0.2.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2021 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deque

type Deque[T any] struct {
	// contains filtered or unexported fields
}

Deque basic generic deque (double-ended queue) implementation based on double-linked list

func NewDeque

func NewDeque[T any]() *Deque[T]

NewDeque TODO

func (*Deque[T]) Back

func (d *Deque[T]) Back() T

Back returns values of the last element in Deque. Calling Back on an empty Deque results in undefined behavior. Complexity - O(1).

func (*Deque[T]) Empty

func (d *Deque[T]) Empty() bool

Empty checks if Deque has no element

func (*Deque[T]) Front

func (d *Deque[T]) Front() T

Front returns values of the first element in Deque. Calling Front on an empty Deque results in undefined behavior. Complexity - O(1).

func (*Deque[T]) PopBack

func (d *Deque[T]) PopBack() T

PopBack returns and removes the last element from Deque. Calling PopBack() on an empty Deque results in undefined behavior. Complexity - O(1).

func (*Deque[T]) PopFront

func (d *Deque[T]) PopFront() T

PopFront returns and removes the first element from Deque. Calling PopFront on an empty Deque results in undefined behavior. Complexity - O(1).

func (*Deque[T]) PushBack

func (d *Deque[T]) PushBack(element T)

PushBack adds element to the end of Deque Complexity - O(1).

func (*Deque[T]) PushFront

func (d *Deque[T]) PushFront(element T)

PushFront adds element before first element of Deque Complexity - O(1).

func (*Deque[T]) Size

func (d *Deque[T]) Size() int

Size returns the number of elements in Deque Complexity - O(1).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL