Title: Two Glass Balls and a Tower
1Two Glass Balls and a Tower
Amihood Amir
Bar Ilan University And Georgia Tech
Gadis office
Costas Iliopoulos
Oren Kapah
2Given A glass ball. An n storied
building. Find The floor k such that the
ball breaks when dropped from it, but does not
break if dropped from floor k-1.
KABLOOIE!!!
3STRATEGY 1 Only one ball given to
experiment with.
O(n) experiments necessary. Sequential search.
4STRATEGY 2 As many balls as necessary are
given to experiment with.
O(log n) experiments necessary. Binary search.
5STRATEGY 3 Only two balls given to
experiment with.
O( ) experiments necessary. Bounded
divide-and-conquer
Experiments 1st ball
Experiments 2nd ball
6Meaning of two Balls
- Bounded Divide-and-Conquer.
In reality Different paradigms. 1. Works on
large groups. 2. Works within a group.
7In Pattern Matching
- Works on large groups
- Convolutions
O(n log m) using FFT
8Problem O(n log m) only in algebraically closed
fields, e.g. C.
Solution Reduce problem to (Boolean/integer/real)
multiplication.
This reduction costs!
Example Hamming distance.
Counting mismatches is equivalent to Counting
matches
9Example
Count all hits of 1 in pattern and 1 in text.
10(No Transcript)
11(No Transcript)
12So for alphabet with a symbols (a fixed) the time
is O(n a log m) O(n log m) Problem Infinite
alphabets.
13Without loss of generality S m 1 Since
every element of T not in P is replaced by some
symbol x not in P.
14Divide and Conquer Idea (Wrong)
Split S to S1 U S2 of size m/2 each. Construct
T1, P1 and T2, P2. Where for S T,
P and e 1, 2
15The Algorithm