Skip to content

psykhi/sequencing

Repository files navigation

This package contains implementation of 4 dynamic programming algorithms:

Levenshtein distance

d := LevenshteinDistance([]byte("kitten"), []byte("sitting"), nil, nil)
//d ==3

Needleman-Wunsch

The NW implementation requires the user to provide a similarity function that can return the similarity between two points

func similarity(a byte, b byte) int {
	if a == b {
		return 1
	}
	return -1
}
a := []byte("ABCDEF")
b := []byte("ABCCDEF")

z, w := NeedlemanWunsch(a, b, -1, similarity, f)