Git Product home page Git Product logo

comp-lib-go's Introduction

Competitive Programming Library for Go

This is a collection of algorithms and data structures written in Go.

They might not all be fast enough for competitive programming platforms like Kattis or CodeForces, but they are good enough for Advent of Code (What I needed them for)

Algorithms / Routines

Binomial Coefficients

binom.go

Binom(n, k int) int O(k)

Dijkstra's

dijkstra.go

Dijkstra(g *GraphMtx, src int) []int O(E*log(V))

Dijkstra_Sparse(g *GraphLst, src int) []int O(V2)

Data Structures

GraphLst (Adjacency List)

graph.go

NewGraphLst(N int) *GraphLst

(g *GraphLst) AddEdge(u, v, w int) O(1) - O(N) worst case

GraphMtx (Adjacency Matrix)

graph.go

NewGraphMtx(N int) *GraphMtx

(g *GraphMtx) AddEdge(u, v, w int) O(1)

Priority Queue

priority_queue.go

NewPQ[T](beforeFunc func(a, b T)bool) *priority_queue[T]

(pq *priority_queue) Push(x T) O(log(N))

(pq *priority_queue) Pop(x T) T O(log(N))

(pq *priority_queue) Top() T O(1)

(pq *priority_queue) Len() int O(1)

(pq *priority_queue) Empty() bool O(1)

Union Find

NewUnionFind(N int) *unionFind O(N)

(uf *unionFind) Find(x int) int O(log(N))

(uf *unionFind) Merge(x int) bool O(log(N))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.