
@@ 21,7 +21,7 @@ the SGB five letter word list. Solutions to these exercises are listed below.

21

21


22

22

```distinct.py``` computes the number of SGB words containing exactly k distinct letters.

23

23


24


```diff_by_one_fixed.py```  (fixed 20190309.) computes the number of words in the SGB


24

+```diff_by_one_fixed.py```  (**fixed 20190309**) computes the number of words in the SGB

25

25

that are off by a single letter in each position. An example is `rover` and `spuds`.

26

26

Each corresponding letter is only different by one: `r > s`, `o>p`, and so on.

27

27

This uses recursive backtracking to generate possible matches for each word, and


@@ 29,13 +29,15 @@ uses a hash table to check for their existence in the original word set.

29

29


30

30

There are 38 such pairs in the SGB.

31

31


32


Also see [https://charlesreid1.com/wiki/F](https://charlesreid1.com/wiki/Letter_Coverage)..


32

+Also see [Five Letter Words](https://charlesreid1.com/wiki/Five_Letter_Words)


33

+on the charlesreid1.com wiki.

33

34


34

35

```diff_by_n_fixed.py```  (added 20190310.) using the corrected approach (above) to

35

36

computing differences by 1, this generalizes the calculation to words that are different

36


by a distance `d` for each letter position. There

37





37

+by a distance `d` for each letter position.

38

38



39

+Also see [Five Letter Words: Part 4: Revisiting Diff by One](https://charlesreid1.github.io/fiveletterwordspart4revisitingdiffbyone.html)


40

+(blog post) on [charlesreid1.github.io](https://charlesreid1.github.io).

39

41


40

42

```euclidean_distance.py```  computes the euclidean distance between two words. This uses

41

43

the traditional Euclidean distance definition but reinterprets distance to mean edit distance.


@@ 46,7 +48,7 @@ the traditional Euclidean distance definition but reinterprets distance to mean

46

48


47

49

### Variations

48

50


49


```diff_by_n.py```  computes words in SGB that have an edit distnace of n.


51

+```diff_by_n.py```  computes words in SGB that have an edit distance of n.

50

52


51

53

```reverse_lexico.py```  variation on ```lexico.py``` that finds words whose letters are in

52

54

reverse lexicographic order.


@@ 61,7 +63,8 @@ of the alphabet. We authored a dynamic program to compute precisely this  given

61

63

number of letters N from the alphabet, this program computes the minimum number of

62

64

words it takes to cover all N letters.

63

65


64


Also see [https://charlesreid1.com/wiki/Letter_Coverage](https://charlesreid1.com/wiki/Letter_Coverage)..


66

+Also see [Letter Coverage](https://charlesreid1.com/wiki/Letter_Coverage)


67

+page on the charlesreid1.com wiki.

65

68


66

69

# Sources

67

70



@@ 69,4 +72,3 @@ Also see [https://charlesreid1.com/wiki/Letter_Coverage](https://charlesreid1.co

69

72

<[http://wwwcsfaculty.stanford.edu/~knuth/sgb.html](http://wwwcsfaculty.stanford.edu/~knuth/sgb.html)>

70

73


71

74


72



