All Projects → steakknife → Hamming

steakknife / Hamming

Licence: mit
Hamming distance and bit counting primitives in Go (golang)

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Hamming

Frosty
serialize native Nim types to strings, streams, or sockets ⛄
Stars: ✭ 25 (-16.67%)
Mutual labels:  binary
Awesome Unam
A curated list of awesome engineering ecosystem, including UNAM Projects
Stars: ✭ 10 (-66.67%)
Mutual labels:  algorithms
Ris
a simple cross-platform resource compiler for c++ projects
Stars: ✭ 15 (-50%)
Mutual labels:  binary
Leetcode Downloader
Download your accepted LeetCode submissions
Stars: ✭ 25 (-16.67%)
Mutual labels:  algorithms
Php Bitmap
Bitmap representation with bitwise operations
Stars: ✭ 7 (-76.67%)
Mutual labels:  binary
Huprog
A repo which includes the HUPROG'17(Hacettepe University Programming Contest)'s questions and the solutions of that questions.
Stars: ✭ 11 (-63.33%)
Mutual labels:  algorithms
Play With Algorithm Interview
Codes of my MOOC Course <Play with Algorithm Interviews>. Updated contents and practices are also included. 我在慕课网上的课程《玩儿转算法面试》示例代码。课程的更多更新内容及辅助练习也将逐步添加进这个代码仓。
Stars: ✭ 915 (+2950%)
Mutual labels:  algorithms
Ds Algo Point
This repository contains codes for various data structures and algorithms in C, C++, Java, Python, C#, Go, JavaScript, PHP, Kotlin and Scala
Stars: ✭ 949 (+3063.33%)
Mutual labels:  algorithms
Awesome Ai Books
Some awesome AI related books and pdfs for learning and downloading, also apply some playground models for learning
Stars: ✭ 855 (+2750%)
Mutual labels:  algorithms
Cub
Cooperative primitives for CUDA C++.
Stars: ✭ 883 (+2843.33%)
Mutual labels:  algorithms
Stanford University Algorithms
Assignments of Stanford University - Algorithms from Coursera
Stars: ✭ 25 (-16.67%)
Mutual labels:  algorithms
Competitive Programming Library
A library designed to improve your competitive programming performance.
Stars: ✭ 26 (-13.33%)
Mutual labels:  algorithms
Phpalgorithms
A collection of common algorithms implemented in PHP. The collection is based on "Cracking the Coding Interview" by Gayle Laakmann McDowell
Stars: ✭ 865 (+2783.33%)
Mutual labels:  algorithms
Haskell
Implementation of All ▲lgorithms in Haskell Programming Language
Stars: ✭ 25 (-16.67%)
Mutual labels:  algorithms
Dlinterview
Deep Learning Interview 深度学习面试题目汇总
Stars: ✭ 943 (+3043.33%)
Mutual labels:  algorithms
Java Competitive Programming
I have written some important Algorithms and Data Structures in an efficient way in Java with proper references to time and space complexity. These Pre-cooked and well-tested codes help to implement larger hackathon problems in lesser time. DFS, BFS, LCA, All Pair Shortest Path, Longest Common Subsequence, Binary Search, Lower Bound Search, Maximal Matching, Matrix Exponentiation, Segment Tree, Sparse Table, Merge Sort, Miller Prime Test, Prims - Minimum Spanning Tree, BIT - Binary Index Tree, Two Pointers, BST - Binary Search Tree, Maximum Subarray Sum, Immutable Data Structures, Persistent Data Structurs - Persistent Trie, Dijkstra, Z - Function, Minimum Cost Maximal Matching, Heavy Light Decomposition, Knapsack, Suffix Array and LCP - Longest Common Prefix, Squre Root Decomposition, Kth Order Statics, Trie / Prefix Tree, LIS - Longest Increasing Subsequence, Hashing
Stars: ✭ 24 (-20%)
Mutual labels:  algorithms
Algo.js
A Very Basic into Intermediate Algorithm Lesson
Stars: ✭ 11 (-63.33%)
Mutual labels:  algorithms
Goridge
High-performance PHP-to-Golang IPC bridge
Stars: ✭ 950 (+3066.67%)
Mutual labels:  binary
Coding Challenges
solutions to coding challenges and algorithm and data structure building blocks
Stars: ✭ 28 (-6.67%)
Mutual labels:  algorithms
Alpg
Visualize and inspect custom algorithms with time travelling
Stars: ✭ 13 (-56.67%)
Mutual labels:  algorithms

GoDoc Build Status

hamming distance calculations in Go

Copyright © 2014, 2015, 2016, 2018 Barry Allard

MIT license

Performance

$ go test -bench=.
BenchmarkCountBitsInt8PopCnt-4      	300000000	         4.30 ns/op
BenchmarkCountBitsInt16PopCnt-4     	300000000	         3.83 ns/op
BenchmarkCountBitsInt32PopCnt-4     	300000000	         3.64 ns/op
BenchmarkCountBitsInt64PopCnt-4     	500000000	         3.60 ns/op
BenchmarkCountBitsIntPopCnt-4       	300000000	         5.72 ns/op
BenchmarkCountBitsUint8PopCnt-4     	1000000000	         2.98 ns/op
BenchmarkCountBitsUint16PopCnt-4    	500000000	         3.23 ns/op
BenchmarkCountBitsUint32PopCnt-4    	500000000	         3.00 ns/op
BenchmarkCountBitsUint64PopCnt-4    	1000000000	         2.94 ns/op
BenchmarkCountBitsUintPopCnt-4      	300000000	         5.04 ns/op
BenchmarkCountBitsBytePopCnt-4      	300000000	         3.99 ns/op
BenchmarkCountBitsRunePopCnt-4      	300000000	         3.83 ns/op
BenchmarkCountBitsInt8-4            	2000000000	         0.74 ns/op
BenchmarkCountBitsInt16-4           	2000000000	         1.54 ns/op
BenchmarkCountBitsInt32-4           	1000000000	         2.63 ns/op
BenchmarkCountBitsInt64-4           	1000000000	         2.56 ns/op
BenchmarkCountBitsInt-4             	200000000	         7.23 ns/op
BenchmarkCountBitsUint16-4          	2000000000	         1.51 ns/op
BenchmarkCountBitsUint32-4          	500000000	         4.00 ns/op
BenchmarkCountBitsUint64-4          	1000000000	         2.64 ns/op
BenchmarkCountBitsUint64Alt-4       	200000000	         7.60 ns/op
BenchmarkCountBitsUint-4            	300000000	         5.48 ns/op
BenchmarkCountBitsUintReference-4   	100000000	        19.2 ns/op
BenchmarkCountBitsByte-4            	2000000000	         0.75 ns/op
BenchmarkCountBitsByteAlt-4         	1000000000	         2.37 ns/op
BenchmarkCountBitsRune-4            	500000000	         2.85 ns/op
PASS
ok  	_/Users/bmf/Projects/hamming	58.305s
$

Usage

import 'github.com/steakknife/hamming'

// ...

// hamming distance between values
hamming.Byte(0xFF, 0x00) // 8
hamming.Byte(0x00, 0x00) // 0

// just count bits in a byte
hamming.CountBitsByte(0xA5), // 4

See help in the docs

Get

go get -u github.com/steakknife/hamming  # master is always stable

Source

Contact

License

MIT license

Copyright © 2014, 2015, 2016 Barry Allard

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].