Documentation ¶
Overview ¶
Package deque represents deque abstract data structure and basic operations on it. Deque is similar to queue, but elements can be inserted and removed from the start and from the end.
Actually deque is the generalized structure of all types of queues.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Deque ¶
type Deque[T any] []T
Deque represents the deque structure.
func (*Deque[T]) Back ¶
func (d *Deque[T]) Back() T
Back returns the back (last) element of the deque.
func (*Deque[T]) Front ¶
func (d *Deque[T]) Front() T
Front returns the front (first) element of the deque.
func (*Deque[T]) PopBack ¶
func (d *Deque[T]) PopBack() T
PopBack pops out an element from the end of the deque and returns popped element. Before pop it is a good practice to check is deque is empty or not.
deque := deque.New[any]() if !deque.Empty() { _ = deque.PopBack() }
func (*Deque[T]) PopFront ¶
func (d *Deque[T]) PopFront() T
PopFront pops out an element from the front of the deque and returns popped element. Before pop it is a good practice to check is deque is empty or not.
deque := deque.New[any]() if !deque.Empty() { _ = deque.PopFront() }