Skip to content

Commit 4755817

Browse files
yanxun827walkccc
authored andcommitted
Update 2.1.md
Fix 2.1-4 bug The final carry over should be 'carried over' to the final element of array C, instead of incorrectly overwriting the second to last element.
1 parent ccd6664 commit 4755817

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/Chap02/2.1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,6 @@ ADD-BINARY(A, B)
6969
for i = 1 to A.length
7070
C[i] = (A[i] + B[i] + carry) % 2 // remainder
7171
carry = (A[i] + B[i] + carry) / 2 // quotient
72-
C[i] = carry
72+
C[i + 1] = carry
7373
return C
7474
```

0 commit comments

Comments
 (0)