Skip to content

lucasgrvarela/priority-queue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Priority Queue in Go

This Go program demonstrates the implementation of a priority queue using the package container/heap. The program initializes a priority queue and adds several tasks with different priorities. The tasks are then processed in priority order, with the highest priority task being processed first.

Usage

  1. Make sure you have Go installed on your system.

  2. Clone the repository:

$ git clone https://github.com/lucasgrvarela/priority-queue.git
  1. Navigate to the project directory:
$ cd priority-queue
  1. Run the program:
$ go run main.go
Length of the priority queue is: 3
Processing task with Priority: 3, ID: 0, Description: 'Do A'
Processing task with Priority: 2, ID: 2, Description: 'Do C'
Processing task with Priority: 1, ID: 1, Description: 'Do B'
Length of the priority queue is: 0

Note: The methods Len(), Less(), Swap(), Push() and Pop() are implemented to satisfy the heap.Interface

About

Demonstrates the implementation of a Priority Queue using the package container/heap

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages