CLRS study. Codes are written with golang.

Overview

algorithms

Go Report CardBuild StatusMaintainabilityTest Coverage

CLRS study. Codes are written with golang.


go version: 1.11


Issues
  • More sqrts than you can shake a stick at

    More sqrts than you can shake a stick at

    During your TSP you continually call sqrt while calculating distances. This is fairly wasteful, since you don't actually care about the root until the end of the function.

    func dist2(lhs Point, rhs Point) float64 {
      dx, dy := lhs.x - rhs.x, lhs.y - rhs.y
      return (dx*dx) + (dy * dy)
    }
    
    func find_closest_2(points []Point) (float64, *Point, *Point, error) {
      if len(points) < 2 {
        return 0, nil, nil, errors.New("must be at least 2 points")
      }
      var first, second *Point
      var shortest_dist float64 = math.MaxFloat64
      for lhs := 0; lhs < len(points) - 1; lhs++ {
        for rhs := lhs + 1; rhs < len(points); rhs++ {
          d2 := dist2(lhs, rhs)
          if d2 < shortest_dist {
            first, second = &lhs, &rhs
            shortest_dist = d2
          }
        }
      }
      return math.sqrt(shortest_dist), first, second, nil
    }
    
    opened by kfsone 2
Owner
Apollo Li
Just for fun!
Apollo Li
Bloomfilter written in Golang.

go-bloom-filter BloomFilter written in Golang. Implementations This repository contains several bloomfilter implementations that you can use to solve

Huy Duc Dao 2 Nov 8, 2021
A Merkle Tree implementation written in Go.

Merkle Tree in Golang An implementation of a Merkle Tree written in Go. A Merkle Tree is a hash tree that provides an efficient way to verify the cont

Cameron Bergoon 345 Jun 22, 2022
Graph algorithms written in Go

Graph Algorithms in Go This repository contains implementations of various graph algorithms written in Go. I’ve written them to learn about these algo

Thomas Cyron 47 Jun 21, 2022
AVL tree with some useful extensions written in Go

gocover An AVL tree (Adel'son-Vel'skii & Landis) is a binary search tree in which the heights of the left and right subtrees of the root differ by at

Michael Lore 28 Mar 23, 2022
Protocol Buffer compiler written in Go

gotoc This is gotoc, a protocol buffer compiler written in Go. This is only the parser side; you will need a plugin to generate code. Quick Start go g

David Symonds 119 Jan 25, 2022
A close implementation of JavaScript's Set written in Go

Set The Set struct allows unique values storing of any type. Initializing a Set s := set.New() // Empty Set s := set.New("hi", 45, Person{name: "Gophe

Sergio Ríos 0 Dec 20, 2021
Common algorithms written in Go.

Common Algorithms in Go This repository contains a collection of a variety of common algorithms implemented using Go. Algorithms Implemented Search Li

Broden Wanner 1 Dec 28, 2021
Mmpxmas-go - ModMyPi Programmable Christmas Tree examples written in Go with go-rpio

ModMyPi Programmable Christmas Tree examples in Go This small program contains examples similar to the examples provided by ModMyPi for interacting wi

Tyler Darnell 0 Jan 4, 2022
This repo is where I'll be attempting to capture some generic algorithms written in Go

Go Generic Algorithms Welcome friends! ?? This repo is where I'll be attempting

TutorialEdge 27 Apr 13, 2022
Golang string comparison and edit distance algorithms library, featuring : Levenshtein, LCS, Hamming, Damerau levenshtein (OSA and Adjacent transpositions algorithms), Jaro-Winkler, Cosine, etc...

Go-edlib : Edit distance and string comparison library Golang string comparison and edit distance algorithms library featuring : Levenshtein, LCS, Ham

Hugo Bollon 329 Jun 21, 2022
Gota: DataFrames and data wrangling in Go (Golang)

Gota: DataFrames, Series and Data Wrangling for Go This is an implementation of DataFrames, Series and data wrangling methods for the Go programming l

null 2.2k Jun 26, 2022
Roaring bitmaps in Go (golang)

roaring This is a go version of the Roaring bitmap data structure. Roaring bitmaps are used by several major systems such as Apache Lucene and derivat

Roaring bitmaps: A better compressed bitset 1.7k Jun 25, 2022
A simple Set data structure implementation in Go (Golang) using LinkedHashMap.

Set Set is a simple Set data structure implementation in Go (Golang) using LinkedHashMap. This library allow you to get a set of int64 or string witho

Studio Sol Comunicação Digital Ltda 21 Apr 6, 2022
skiplist for golang

skiplist reference from redis zskiplist Usage package main import ( "fmt" "github.com/gansidui/skiplist" "log" ) type User struct { score float6

gansidui 79 May 7, 2022
An in-memory string-interface{} map with various expiration options for golang

TTLCache - an in-memory cache with expiration TTLCache is a simple key/value cache in golang with the following functions: Expiration of items based o

Rene Kroon 442 Jun 25, 2022
Double-ARray Trie System for golang

Darts This is a GO implementation of Double-ARray Trie System. It's a clone of the C++ version Darts can be used as simple hash dictionary. You can al

Andy Song 93 Apr 10, 2022
Golang implementation of Radix trees

go-radix Provides the radix package that implements a radix tree. The package only provides a single Tree implementation, optimized for sparse nodes.

Armon Dadgar 734 Jun 19, 2022
Golang library for reading and writing Microsoft Excel™ (XLSX) files.

Excelize Introduction Excelize is a library written in pure Go providing a set of functions that allow you to write to and read from XLSX / XLSM / XLT

360 Enterprise Security Group, Endpoint Security, inc. 12.1k Jun 29, 2022
HyperLogLog and HyperLogLog++ implementation in Go/Golang.

HyperLogLog and HyperLogLog++ Implements the HyperLogLog and HyperLogLog++ algorithms. HyperLogLog paper: http://algo.inria.fr/flajolet/Publications/F

Clark DuVall 408 Jun 24, 2022