queue

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2022 License: BSD-3-Clause Imports: 0 Imported by: 0

Documentation

Overview

Package queue provides implementation for Queue data structure https://en.wikipedia.org/wiki/Queue_(abstract_data_type)

Interface methods Enqueue,Dequeue, IsEmpty, Length are the ways to interact with queue data structure. The test file queue_test.go illustrates usage of these methods

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Queue

type Queue[T any] interface {
	// Enqueues element
	Enqueue(x T)

	// Dequeues element
	// If queue is empty, it panics
	Dequeue() T

	// IsEmpty returns true if queue is empty
	IsEmpty() bool

	// Length returns number of elements in the queue
	Length() int
}

FIFO Queue

func NewQueue

func NewQueue[T any]() Queue[T]

Jump to

Keyboard shortcuts

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