CPS ASSIGNMENT
Problem space:
Each letter (C, O, M, E, G, N, H, S) represents a unique digit (0–9).
We must find digits that satisfy:
COME +GONE=HOMES
Logical Reasoning (Initial Constraint):
*There are 8 letters in COME and GONE so we have to select 4 digit out of 10(0-9)in an order
form so we have p(10,8)=18144000 ways to select them.
*each letter should represent by one unique digit
*C and G cannot be zero because they are leading letters
*we get the result in 5 letter by adding 2 four letters word so H should be equal to 1 which is the
carry of thousands place .
Abstraction and Data Organization:
Digit Availability
1 Available
2 Available
3 Available
4 Available
5 Available
6 Available
7 Available
8 Available
9 Available
Unique letters:C,O,M,E,G,N,H,S
Letter Assigned Digit Status
C Unassigned
O Unassigned
M Unassigned
E Unassigned
G Unassigned
N Unassigned
Fixed (carry
H 1
digit)
S Unassigned
Algorithmic Thinking:
Decomposition : We will systematically assign digits and check constraints column by column
Ones:E+E=S+10*c1
S=2E mod 10 and c1=2E//10(floor value)
Tens :M+N+c1=E+10*c2
Hubndreds : O+O+c2=M+10c3
Thousands: C+ G+ c 3=O+10 H
Since H=1
Pseudocode:
Solution and Evaluation:
Through systematic testing (using logic or code), we find a valid mapping:
Letter Digit
C 9
Letter Digit
O 3
M 7
E 6
G 4
N 8
H 1
S 2
Verification:
9376+4386=13762
Critical Error Example:
*Assigning the same digit to two letters violates uniqueness.
*Forgetting to enforce that C , G ≠ 0could produce invalid leading zeros.
# total number of possible ways to assign 10 unique digits
to 10 unique letters: 10!=10*9*8*7*6*5*4*3*2*1