queue

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockingQueue

type BlockingQueue[T comparable] struct {
	*LinkedQueue[T]
}

func NewBlockingQueue

func NewBlockingQueue[T comparable]() *BlockingQueue[T]

func (*BlockingQueue[T]) Remove

func (bq *BlockingQueue[T]) Remove() (T, error)

func (*BlockingQueue[T]) RemoveWithTimeout

func (bq *BlockingQueue[T]) RemoveWithTimeout(duration time.Duration) (T, error)

type Deque

type Deque[T comparable] struct {
	*LinkedQueue[T]
}

func NewDeque

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

func (*Deque[T]) AddFirst

func (dq *Deque[T]) AddFirst(e T)

func (*Deque[T]) PeekLast

func (dq *Deque[T]) PeekLast() (T, error)

func (*Deque[T]) RemoveLast

func (dq *Deque[T]) RemoveLast() (T, error)

type LinkedQueue

type LinkedQueue[T comparable] struct {
	// contains filtered or unexported fields
}

func NewLinkedQueue

func NewLinkedQueue[T comparable]() *LinkedQueue[T]

func (*LinkedQueue[T]) Add

func (lq *LinkedQueue[T]) Add(e T)

func (*LinkedQueue[T]) Clear

func (lq *LinkedQueue[T]) Clear()

func (*LinkedQueue[T]) Empty

func (lq *LinkedQueue[T]) Empty() bool

func (*LinkedQueue[T]) Peek

func (lq *LinkedQueue[T]) Peek() (T, error)

func (*LinkedQueue[T]) Remove

func (lq *LinkedQueue[T]) Remove() (T, error)

func (*LinkedQueue[T]) Size

func (lq *LinkedQueue[T]) Size() int64

type PriorityQueue

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

func NewPriorityQueue

func NewPriorityQueue[T any](isMax bool, c comparator.Comparator[T]) *PriorityQueue[T]

func (*PriorityQueue[T]) Add

func (pq *PriorityQueue[T]) Add(e T)

func (*PriorityQueue[T]) Clear

func (pq *PriorityQueue[T]) Clear()

func (*PriorityQueue[T]) Empty

func (pq *PriorityQueue[T]) Empty() bool

func (*PriorityQueue[T]) Peek

func (pq *PriorityQueue[T]) Peek() (T, error)

TODO: IMPLEMENT PEEK IN HEAP AND CHANGE IT HERE

func (*PriorityQueue[T]) Remove

func (pq *PriorityQueue[T]) Remove() (T, error)

func (*PriorityQueue[T]) Size

func (pq *PriorityQueue[T]) Size() int64

type Queue

type Queue[T comparable] interface {
	Add(e T)

	Remove() (T, error)

	Peek() (T, error)

	Empty() bool
	Size() int64
	Clear()
}

Jump to

Keyboard shortcuts

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