goqueue

package module
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: MIT Imports: 1 Imported by: 0

README

linkedlist-queue

Documentation

Overview

Implementation queue with linkedlist

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type List added in v1.0.6

type List struct {
	Head *Node
	Tail *Node
}

Linkedlist (Head, Tail)

func (*List) Dequeue added in v1.0.6

func (l *List) Dequeue() interface{}

Remove and retrieves the first element of this deque

func (*List) Enqueue added in v1.0.6

func (l *List) Enqueue(data interface{})

Inserts the specified element at the end of this queue

func (*List) Peek added in v1.0.6

func (l *List) Peek() interface{}

Retrieves, but does not remove, the first element of this deque

func (*List) String added in v1.0.6

func (l *List) String() string

Get all element in Queue

type Node

type Node struct {
	Prev *Node
	Next *Node
	Data interface{}
}

Linkedlist node (Prev, Next, Data)

func NewNode

func NewNode(data interface{}) *Node

Create new node

type Queue

type Queue interface {
	Enqueue(data interface{})
	Dequeue() interface{}
	String() string
	Peek() interface{}
}

Interface Queue

func NewQueue

func NewQueue() Queue

Initialize new queue

Jump to

Keyboard shortcuts

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