Using backtracking, write a program that solves summation puzzles in which each letter should be replaced by
Question:
Using backtracking, write a program that solves summation puzzles in which each letter should be replaced by a digit, such as send + more = money Your program should find the solution 9567 + 1085 = 10652. Other examples are base + ball = games and kyoto + osaka = tokyo. In a partial solution, some of the letters have been replaced with digits. In the third example, you would consider all partial solutions where k is replaced by 0, 1, ... 9: 0yoto + osa0a = to0yo, 1yoto + osa1a = to1yo, and so on. To extend a partial solution, find the first letter and replace all instances with a digit that doesn’t yet occur in the partial solution. If a partial solution has no more letters, check whether the sum is correct.
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Question Posted: