queue

package module
v0.0.0-...-3292fe0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2020 License: MIT Imports: 0 Imported by: 0

README

Queue

Queue definition

A queue is a collection of entities that are maintained in a sequence and can be modified by the addition of entities at one end of the sequence and the removal of entities from the other end of the sequence. The operation of adding an element to the rear of the queue is known as enqueue, and the operation of removing an element from the front is known as dequeue. Other operations may also be allowed, often including a peek or front operation that returns the value of the next element to be dequeued without dequeuing it.

The operations of a queue make it a first-in-first-out (FIFO) data structure. In a FIFO data structure, the first element added to the queue will be the first one to be removed.

Documentation

Overview

Package queue implements:

a a new type named Stack, which is a slice of ints
**Enqueue** method to add an element at the end of the Queue
**Dequeue** method to remove the element from the the front of the Queue

Package queue implements:

a a new type named Stack, which is a slice of ints
**Enqueue** method to add an element at the end of the Queue
**Dequeue** method to remove the element from the the front of the Queue

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Queue

type Queue []int

Queue represent a stack

func (*Queue) Dequeue

func (q *Queue) Dequeue() (int, bool)

Dequeue remove an element at the front of the queue

func (*Queue) Enqueue

func (q *Queue) Enqueue(element int)

Enqueue insert an elememnt at the back of the queue

type QueueString

type QueueString []string

Queue represent a stack

func (*QueueString) Dequeue

func (q *QueueString) Dequeue() (string, bool)

Dequeue remove an element at the front of the queue

func (*QueueString) Enqueue

func (q *QueueString) Enqueue(element string)

Enqueue insert an elememnt at the back of the queue

Jump to

Keyboard shortcuts

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