sture

package module
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2022 License: MIT Imports: 1 Imported by: 0

README

Sture

A collection of data structures based on Go 1.18+ Generics.

Why this name?

I basically used an AI to generate the name sture 🗿. But... sture can be interpreted as "structure".

Installation

go get github.com/HotPotatoC/sture

Usage

Creating a priority queue using:

import "github.com/HotPotatoC/sture/queue"

func main() {
    pq := queue.NewPriorityQueue[string]()

    pq.Enqueue("Adam", 1)
    pq.Enqueue("John", 3)
    pq.Enqueue("Bob", 2)

    top := pq.Peek()
    fmt.Println(top) // John
}

See more examples here

Spec

Supported data structures at the moment:

Support

If this project is helpful to you, please consider supporting me by donating or just give this project a 🌟

Buy Me A Coffee

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare[T constraints.Ordered](x, y T) int

Compare[T constraints.Ordered] is a function that returns -1, 0, or 1 depending on whether x < y, x == y, or x > y.

func Max

func Max[T constraints.Ordered](x, y T) T

Max returns the maximum of two values.

func Min

func Min[T constraints.Ordered](x, y T) T

Min returns the minimum of two values.

Types

This section is empty.

Directories

Path Synopsis
example

Jump to

Keyboard shortcuts

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