Download Homework solution Q1 Prove that the ISBN detects 100% of the

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Positional notation wikipedia , lookup

Space wikipedia , lookup

Elementary arithmetic wikipedia , lookup

Approximations of π wikipedia , lookup

Transcript
Homework solution
Q1
Prove that the ISBN detects 100% of the single-position errors.
Solution:
Let’s say the correct number is a1a2a3a4a5a6a7a8a9a10
Assume a mistake is made in the second position.
(The same argument applies equally well in every position.)
Then, the incorrect number becomes a1a’2a3a4a5a6a7a8a9a10, where a’2 ≠ a2
For this error to go undetected, it must be the case that 10a1 + 9a’2 + 8a3 + 7a4 + 6a5
+ 5a6 + 4a7 + 3a8 + 2a9 + a10 is divisible by 11.
Remember that for the correct number, 10a1 + 9a2 + 8a3 + 7a4 + 6a5 + 5a6 + 4a7 + 3a8
+ 2a9 + a10 is also divisible by 11.
The difference = (10a1 + 9a2 + 8a3 + 7a4 + 6a5 + 5a6 + 4a7 + 3a8 + 2a9 + a10)
- (10a1 + 9a2 + 8a3 + 7a4 + 6a5 + 5a6 + 4a7 + 3a8 + 2a9 + a10)
= 9(a2 - a’2)
Note that a2 and a’2 are digits between 0 and 9, they are distinct.
their difference must be one of 9(±1), 9(±2), … , 9(±9)
i.e. ±9, ±18, ±27, ±36, ±45, ±54, ±63, ±72, ±81
However, none of them is divisible by 11
So, a single position error can always be detected.
Q2
The following is an actual identification number and bar code from a roll of
wallpaper.
What appears to be wrong with them? Speculate on the reason for the apparent
violation of the UPC format. (Write at least two)
Solution:
1. UPC scheme has 12 digits but there are 13 digits in the barcode above.
2. The check digit calculated should be 4 instead of 6.
3. The centre bar pattern should be in the following sequence: light space, dark bar,
light space, dark bar, light space.
4. The guard bar patterns are wrong in two end, it should be a pattern with two long
dark bar separated by a light space.
5. the number under the barcode is inconsistent with the manufacture number as
well as the dark bar and light space patterns.
Extra. Compare the advantages and the disadvantages of the algorithm methods
stated in class. Give examples on the purpose of each method.
Method Purpose Advantage
UPC
ID
Grocery
products
Disadvantage
1. Detect all
single-position
errors
2. Detects
90% of
transposition
errors
3. Tell more
than id
product
Codabar
Credit
1. Detect all
Cards
single-position computer to
errors
solve and assign
numbers
2. 98% of
Bank
Accounts
Divers
License
Needs a
transposition
errors
3. partially
eliminate
fraud
ISBN
ID Books 1. Detects all
single-position
and
transposition
errors
Last check digit
can be the letter
X
represents a 10