Question: Using backtracking, write a program that solves summation puzzles in which each letter should be replaced by a digit, such as send + more =
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.
Step by Step Solution
3.45 Rating (168 Votes )
There are 3 Steps involved in it
This is indeed a challenging problem Its particularly difficult because we ... View full answer
Get step-by-step solutions from verified subject matter experts
