Documentation
¶
Overview ¶
Implementations of a doubly linked list.
Index ¶
- type CircularBuffer
- func (d *CircularBuffer[T]) IsEmpty() bool
- func (d *CircularBuffer[T]) PeekBack() T
- func (d *CircularBuffer[T]) PeekFront() T
- func (d *CircularBuffer[T]) PopBack() T
- func (d *CircularBuffer[T]) PopFront() T
- func (d *CircularBuffer[T]) PushBack(value T)
- func (d *CircularBuffer[T]) PushFront(value T)
- func (d *CircularBuffer[T]) Size() int
- type Deque
- type List
- type Node
- type Queue
- type Stack
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CircularBuffer ¶
type CircularBuffer[T any] struct { // contains filtered or unexported fields }
A Double-ended-queue that is implemented using a circular dynamic buffer.
func NewCircularBuffer ¶
func NewCircularBuffer[T any]() *CircularBuffer[T]
Creates a new empty CircularBuffer.
func (*CircularBuffer[T]) IsEmpty ¶
func (d *CircularBuffer[T]) IsEmpty() bool
func (*CircularBuffer[T]) PeekBack ¶
func (d *CircularBuffer[T]) PeekBack() T
func (*CircularBuffer[T]) PeekFront ¶
func (d *CircularBuffer[T]) PeekFront() T
func (*CircularBuffer[T]) PopBack ¶
func (d *CircularBuffer[T]) PopBack() T
func (*CircularBuffer[T]) PopFront ¶
func (d *CircularBuffer[T]) PopFront() T
func (*CircularBuffer[T]) PushBack ¶
func (d *CircularBuffer[T]) PushBack(value T)
func (*CircularBuffer[T]) PushFront ¶
func (d *CircularBuffer[T]) PushFront(value T)
Pushes a value onto the front of the CircularBuffer.
func (*CircularBuffer[T]) Size ¶
func (d *CircularBuffer[T]) Size() int
type Deque ¶
type Deque[T any] interface { PushFront(value T) PushBack(value T) PopFront() T PopBack() T PeekFront() T PeekBack() T IsEmpty() bool }
Deque is a double-ended queue
type List ¶
type List[T any] struct { // The head of the list is the fist element Head *Node[T] // The tail of the list is the last element Tail *Node[T] // The number of elements in the list Size int }
List[T] is a doubly linked list. It implements the dequeue interface.
type Node ¶
func FindBack ¶
func FindBack[T comparable](list *List[T], value T) *Node[T]
func FindFront ¶
func FindFront[T comparable](list *List[T], value T) *Node[T]
type Queue ¶
type Queue[T any] struct { // contains filtered or unexported fields }
A Queue that is implemented using a linked list.
type Stack ¶
type Stack[T any] struct { // contains filtered or unexported fields }
Implements a stack using a linked list.
func NewCircularBufferStack ¶
func NewListStack ¶
Click to show internal directories.
Click to hide internal directories.