Skip to content

The Algorithms - Go

A collection of classic algorithms and data structures written in Go, for learning.TheAlgorithms/Go

Stars
18.2k
Forks
2.8k
Licence
MIT
Language
Go
Last update
3 months ago
Type
Learning resource

What it is

This is a repository of algorithms and data structures implemented in Go, the programming language. It is organized into packages by topic, such as strings, math, caches, ciphers, and checksums, with function-level documentation generated from the code. The project is community-maintained, is licensed under MIT, and is aimed at education.

  • Read the Aho-Corasick string search or the LRU and LFU cache implementations to see how they are written in Go
  • Browse the math and binary packages for bit-manipulation examples such as counting set bits or checking for powers of two
  • Run the Caesar cipher package's encrypt and decrypt functions to see a simple cipher in code
  • Use the package listing to find an implementation to study before writing your own

Great for

  • Beginners learning Go who want to read working implementations of common algorithms
  • Students studying data structures or algorithms who want to compare them against a Go version
  • People preparing for coding interviews who want reference code to read
  • Contributors who want to add an implementation following the project's guidelines

Not ideal for

  • Developers who need a production-ready library, since the README frames the code as educational
  • People looking for a single installable tool or app, because this is a set of code packages to read and import
  • Readers who need a full tutorial explanation of each algorithm, since the README excerpt lists functions but gives little prose per algorithm
Step-by-step guide: how to use The Algorithms - GoInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Clone and build from source

    You'll need: Go

    Clone the repository

    git clone https://github.com/TheAlgorithms/Go
  2. 2

    Run it

    • Clone the repository and open it in your editor
    • Open a package folder such as math/binary or cache to read its source files
    • Read the function comments and the linked source lines in the README listing
    • Run the package's tests if you want to check behavior, after confirming the test command in the repository
  3. 3

    Get the most out of it

    • Use the README's package listing as a table of contents and jump to the source line links
    • Read the Contribution Guidelines (CONTRIBUTING.md) before adding code
    • Compare implementations with the alternatives listed below to see different approaches
    • Check the project's homepage at the-algorithms.com for the language-specific index

Downloads

Strengths

  • Covers many topics in one place, including sorting, search, caches, ciphers, and checksums
  • Licensed under MIT, so the code can be reused under permissive terms
  • Documentation lists each function with a short description and a link to its source line

Trade-offs

  • The README excerpt does not describe how to run or test the code, so the setup path is unclear
  • Some entries have no description, such as IsArmstrong and Sqrt in the listing
  • No release is published, so there is no versioned package to depend on

How it compares

ProjectStarsTypeLevelUpdatedBest for
Go (this)18.2kLearning resourcebeginner3 months agoBeginners learning Go who want to read working implementations of common algorithms
Python226kLearning resourcebeginner17 days agoStudents learning algorithms and data structures
Java66.7kLearning resourcebeginner4 days agoStudents learning algorithms and data structures in Java
C-Plus-Plus34.8kLearning resourceintermediate1 months agoStudents learning algorithms and data structures in C++
javascript-algorithms197kLearning resourcebeginner3 months agoStudents learning core computer science concepts in JavaScript
interviews65.5kLearning resourcebeginner1.5 years agoStudents preparing for their first software engineering interviews

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.