queue

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package queue provides an interface and implementations for the queue abstract data type

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LLQueue

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

func NewLLQueue

func NewLLQueue[T any]() *LLQueue[T]

NewLLQueue instantiates a new linked list queue and returns a pointer to it.

func (*LLQueue[T]) Insert

func (q *LLQueue[T]) Insert(i T)

Add inserts a new item at the end of the queue.

func (*LLQueue[T]) Remove

func (q *LLQueue[T]) Remove() (T, bool)

Remove removes and returns the item at the head of the queue.

func (*LLQueue[T]) Size

func (q *LLQueue[T]) Size() int

Size returns the number of items in the queue.

type Queue

type Queue[T any] interface {
	Size() int
	Insert(i T)
	Remove() (T, bool)
}

Jump to

Keyboard shortcuts

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