QueueGo

command module
v0.0.0-...-ffad515 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2022 License: GPL-3.0 Imports: 1 Imported by: 0

README

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

Documentation

Overview

* @Name: Queue Go * @Author: Max Base * @Date: 2022-11-07 * @Repository: https://github.com/basemax/QueueGo

Jump to

Keyboard shortcuts

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