https://github.com/golang-infrastructure/go-hamming-distance
汉明距离(Hamming Distance)
https://github.com/golang-infrastructure/go-hamming-distance
hamming-distance
Last synced: 3 months ago
JSON representation
汉明距离(Hamming Distance)
- Host: GitHub
- URL: https://github.com/golang-infrastructure/go-hamming-distance
- Owner: golang-infrastructure
- License: mit
- Created: 2022-12-04T14:37:03.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-12-04T16:03:31.000Z (over 2 years ago)
- Last Synced: 2025-01-18T16:11:10.786Z (5 months ago)
- Topics: hamming-distance
- Language: Go
- Homepage:
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 汉明距离(Hamming Distance)
# 一、安装
```bash
go get -u github.com/golang-infrastructure/go-hamming-distance
```# 二、代码示例
计算Int类型的汉明距离:
```go
a := 1
b := 3
distance := hamming_distance.Int(a, b)
t.Log(distance)
// Output:
// 1
```计算String类型的汉明距离:
```go
s1 := "abcd"
s2 := "abcf"
distance := hamming_distance.String(s1, s2)
// distance, err := hamming_distance.StringE(s1, s2)
t.Log(distance)
// Output:
// 1
```# 三、汉明距离是什么及实现方式
TODO 2022-12-4 23:55:26