1 / 8

Vive la Difference! How fast does it converge?

David Van Brackle Chief Judge, Southeast USA Region, ICPC. Vive la Difference! How fast does it converge?. The Problem. Take any four positive integers: a , b , c , d . Form four more, like this: | a - b | | b - c | | c - d | | d - a |

demont
Download Presentation

Vive la Difference! How fast does it converge?

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. David Van Brackle Chief Judge, Southeast USA Region, ICPC Vive la Difference!How fast does it converge?

  2. The Problem Take any four positive integers: a, b, c, d. Form four more, like this: |a-b| |b-c| |c-d| |d-a| That is, take the absolute value of the differences of a with b, b with c, c with d, and d with a. (Note that a zero could crop up, but they’ll all still be non-negative.) Then, do it again with these four new numbers. And then again. And again. Eventually, all four integers will be the same. For example, start with 1,3,5,9: 1 3 5 9 2 2 4 8 (1) 0 2 4 6 (2) 2 2 2 6 (3) 0 0 4 4 (4) 0 4 0 4 (5) 4 4 4 4 (6) In this case, the sequence converged in 6 steps. It turns out that in all cases, the sequence converges very quickly. In fact, it can be shown that if all four integers are less than 2n, then it will take no more than 3*n steps to converge!

  3. First, a helpful fact If k is an integer, then [a+k, b+k, c+k, d+k] converges in exactly the same number of steps as [a, b, c, d] Proof: [|(b+k)-(a+k)|,|(c+k)-(b+k)|, |(d+k)-(c+k)|, |(a+k)-(d+k)|] = [|b-a|,|c-b|,|d-c|,|a-d|] Corollary: [a-k, b-k, c-k, d-k] converges in the same number of steps as [a, b, c, d]

  4. Another helpful fact If k is an integer, then [a*k, b*k, c*k, d*k] converges in exactly the same number of steps as [a, b, c, d] Proof: [|(b*k)-(a*k)|,|(c*k)-(b*k)|, |(d*k)-(c*k)|, |(a*k)-(d*k)|] = [k*|b-a|,k*|c-b|,k*|d-c|,k*|a-d|] Corollary: [a/k, b/k, c/k, d/k] converges in the same number of steps as [a, b, c, d] provided that a/k, b/k, c/k and d/k are all integers.

  5. More Helpful Facts • Rotations all converge in the same number of steps: • [a, b, c, d] • [b, c, d, a] • [c, d, a, b] • [d, a, b, c] • Let E denote an Even number, D an Odd number. Then • |E-E| is E • |E-D| is D • |D-E| is D • |D-D| is E

  6. Now, the proof • Prove: if a, b, c and d are all non-negative integers less than 2n, then [a, b, c, d] converges in 3*n or fewer steps. • Proof: By Induction.

  7. Base n=1, 2n = 2, so it’s all 0’s and 1’s 4 1’s: [1, 1, 1, 1] has already converged 3 1’s: [1, 1, 1, 0]  [0, 0, 1, 1]  [0, 1, 0, 1]  [1, 1, 1, 1] 2 1’s: either [0, 0, 1, 1] or [0, 1, 0, 1] Either way, it’s a subset of above 1 1: [1, 0, 0, 0]  [1, 0, 0, 1]  [1, 0, 1, 0]  [1, 1, 1, 1] 0 1’s: [0, 0, 0, 0] has already converged So, it takes a maximum of 3 steps to converge.

  8. Induction Assume true for n-1. Assume [a, b, c, d] are all <2n All Even: [E, E, E, E] converges in the same number of steps as [E/2, E/2, E/2, E/2], all of which are less than 2n-1 All Odd: [D, D, D, D] converges in the same number of steps as [D-1,D-1,D-1,D-1], which is All Even 3 E’s: [E, E, E, D]  [E, E, D, D]  [E, D, E, D]  [D, D, D, D] 2 E’s: either [E, E, D, D] or [E, D, E, D] Either way, it’s a subset 1 E: [E, D, D, D]  [D, E, E, D]  [D, E, D, E]  [D, D, D, D] So, it takes a maximum of 3 steps to reduce to something that takes 3*(n-1) steps. That’s a max of 3+3*(n-1) or 3*n

More Related