Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

This is a simple implementation of a queue using a linked-list in Go. This is a good example of how to use a linked-list in Go.

License

Notifications You must be signed in to change notification settings

BaseMax/QueueLinkedListGo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Queue Linked-List Go

This is a simple implementation of a queue using a linked-list in Go. This is a good example of how to use a linked-list in Go.

Functions

Public functions:

  • func NewQueueLinkedList() *QueueLinkedList: Create a new queue

Methods:

  • func (q *QueueLinkedList) Enqueue(data interface{}): Add a new element to the queue (to the tail)
  • func (q *QueueLinkedList) EnqueueHead(data interface{}): Add a new element to the queue (to the head)
  • func (q *QueueLinkedList) Dequeue() interface{}: Remove the first element from the queue (from the head)
  • func (q *QueueLinkedList) DequeueTail() interface{}: Remove the first element from the queue (from the tail)
  • func (q *QueueLinkedList) Peek() interface{}: Get the first element from the queue (from the head)
  • func (q *QueueLinkedList) PeekTail() interface{}: Get the first element from the queue (from the tail)
  • func (q *QueueLinkedList) IsEmpty() bool: Check if the queue is empty
  • func (q *QueueLinkedList) Size() int: Get the size of the queue
  • func (q *QueueLinkedList) Clear(): Clear the queue
  • func (q *QueueLinkedList) Print(): Print the queue
  • func (q *QueueLinkedList) Reverse(): Reverse the queue
  • func (q *QueueLinkedList) ReverseRecursive(Node *Node) *Node: Reverse the queue (recursive)

Types:

type Node struct {
	data interface{}
	next *Node
}

type QueueLinkedList struct {
	head *Node
	tail *Node
}

License

This project is licensed under the GPL-3.0 License - see the LICENSE file for details.

© Copyright (c) 2022, Max Base

About

This is a simple implementation of a queue using a linked-list in Go. This is a good example of how to use a linked-list in Go.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.