Skip to content

The implentation of queue structure in Go. The queue is a FIFO (First In First Out) data structure.

License

Notifications You must be signed in to change notification settings

BaseMax/QueueGo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Queue Go (QueueGo)

The implentation of queue structure in Go. The queue is a FIFO (First In First Out) data structure.

Installation

go get github.com/BaseMax/QueueGo

Usage

package main

import "fmt"

// main function
func main() {
	fmt.Print("Hello, world.\n")

	// create new queue
	q := NewQueue()

	// add items to queue
	q.Enqueue(1)

	// check if queue is empty
	fmt.Printf("Is queue empty? %v\n", q.IsEmpty())

	// check if queue is full
	fmt.Printf("Is queue full? %v\n", q.IsFull())

	// get size of queue
	fmt.Printf("Size of queue: %v\n", q.Size())

	// get front item of queue
	fmt.Printf("Front item of queue: %v\n", q.Front())

	// get rear item of queue
	fmt.Printf("Rear item of queue: %v\n", q.Rear())

	// remove item from queue
	fmt.Printf("Removed item from queue: %v\n", q.Dequeue())

	// check if queue is empty
	fmt.Printf("Is queue empty? %v\n", q.IsEmpty())

	// check if queue is full
	fmt.Printf("Is queue full? %v\n", q.IsFull())

	// get size of queue
	fmt.Printf("Size of queue: %v\n", q.Size())

	// get front item of queue
	fmt.Printf("Front item of queue: %v\n", q.Front())
}

© Copyright 2022, Max Base

About

The implentation of queue structure in Go. The queue is a FIFO (First In First Out) data structure.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages