Presentation is loading. Please wait.

Presentation is loading. Please wait.

APS various problems. Not all bit-strings are compressible. If we have a bit string length n, sometimes we can compress it to a shorter bit string! Here.

Similar presentations


Presentation on theme: "APS various problems. Not all bit-strings are compressible. If we have a bit string length n, sometimes we can compress it to a shorter bit string! Here."— Presentation transcript:

1 APS various problems

2 Not all bit-strings are compressible. If we have a bit string length n, sometimes we can compress it to a shorter bit string! Here we will use the pigeon hole principle to show that it is not possible to compress all bit strings. There are 2^{n} bit strings of length n, but only 2^{n}-1 bit strings of length n-1. Therefore there is one more bit string of length n, than there are bit string of length n-1.

3 One way Roads Problem. In one country every city is connected to every other city by a road. There is too much traffic so the government decides to make all the roads one way. Show that there is a city (we can call it the capital city), which can be reached from all other cities directly, or indirectly by passing at most one other city. Let’s draw a few examples to illustrate this.

4 Two marbles problem. You have two marbles. You wish to know from which floors of a high building it is safe to drop a marble from so it will not break, and what floor it will break. What is the best strategy. Make all reasonable assumptions e.g. a marble either shatters or it does not (i.e. it does not chip a little bit on each drop). Hint – binary search is tempting but incorrect.

5 The ISBN code – example of mod. Every recent book has a International Standard Book Number (ISBN). Example 0-19-8596170-0 First digit = 0 = English Next 2 digits = publisher Next 6 digits = book number Final digit is check ∑id i = 0 mod 11. Weighted check sum.

6 The ISBN code 2. If the weighted check sum = 10 then we write an X as a single character instead. The ISBN code is designed to detect A) any single error B) any double-error created by the transposition of two digits. If the weighted check sum ≠ 0 then we have detected an error.

7 Linked Chain Problem We have 4 chains each of 3 links. Connect all the chains together into a loop with the minimum number of operations. An operation is opening and closing a link.

8 Map of London Problem You are in London and you have a map of London. You place the map on the ground. Prove that there is a point on the map which is directly above the corresponding point in London.

9 Another Proof of Incompressibility Last time we saw that not all bit strings are compressible – because there are not enough shorter bit strings! This was an application of the pigeon hole principle. Alternatively, imagine we have a compression program, and we compress a string, and then we compress the compressed string, and repeat – eventually we will get 0 or 1!!!

10 The Square Root of 2 is Irrational. A classic proof by contradiction from mathematics is the. If it were rational, it could be expressed as a fraction a/b in lowest terms, where a and b are integers, at least one of which is odd. But if a/b = √2, then a 2 = 2b 2. Therefore a 2 must be even. Because the square of an odd number is odd, that in turn implies that a is even. This means that b must be odd because a/b is in lowest terms.

11 The Square Root of 2 is Irrational. On the other hand, if a is even, then a 2 is a multiple of 4. If a 2 is a multiple of 4 and a 2 = 2b 2, then 2b 2 is a multiple of 4, and therefore b 2 is even, and so is b. So b is odd and even, a contradiction. Therefore the initial assumption—that √2 can be expressed as a fraction—must be false.

12 A different proof a/b = √2, then a 2 = 2b 2 {take a function of both sizes}. exp(a 2 )= exp(2b 2 ) {exp.k is the number of times 2 divides k notable exp.2=1 and exp nm = exp.n+exp.m} 1+2.exp.n = 2.exp.m {an odd number cannot equal an even number} Therefore false.

13 Revision of Fake Coins Again We have a set of coins – one may be fake. When we weight the coins – we can put them in three places – left, right, table. If they do not balance – then we can discard the coins on the table – but we have also learnt something about the coins on the scales (possibly heavier or possibly lighter)

14 Bugs Problem Four bugs are at the corners of a square. The each begin to chase each other (along the sides). What is the invariant here? How far do they walk before the catch each other?

15 Birthday Problem 1 What is the probability two people share the same birthday? How many people do we need in a room so there is a 50% probability that a pair of people share a birthday.

16 Birthday Problem 2 What is the probability that at least one person shares the same birthday as me? How many people do we need in a room so there is a 50% probability that a pair of people share a birthday.

17


Download ppt "APS various problems. Not all bit-strings are compressible. If we have a bit string length n, sometimes we can compress it to a shorter bit string! Here."

Similar presentations


Ads by Google