andreamad8 / Algo2Problems

2016/1027

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ex6 new solution

delleciliege opened this issue · comments

I put a new solution based on the same idea of the first but with a different proof (based on the alternative solution proposed but never finished which is in the directory EX6).

Probably I did it to much formal, but the idea behind is very simple and in my opinion simpler then the first one.
Even if you prefer a more informal approach you can steal something from each of the two solution.

Let me know if it is correct.

By the way, the reason I was stick in the mud with this exercise is that it is not a generalization of the exercise 7 (as Grossi use to say).
Here the main problem in finding a deterministic solution is that we have a finite amount of memory, in ex7 we have a counter which can grow infinitely, otherwise the solution given is not correct.

The ex6 would have been a generalization of ex7 if we had had log n bits for storing an item and log m bits for storing the counters where n is the size of the alphabet of the string (as it is in the text of the exercise) and m is the length of the stream (and this is very harder to proof!).

Just as example please note that the solution we gave to ex6 (with all the different proofs) uses only two different symbols for the streams, then of course if one of the two occur most frequently it will also occur in more than the half of the stream... and then why can't we use the algorithm we present in the solution of ex7?
Because the ex7 is not a particular case of the ex6.

I wrote it in case this was confusing some other student other than me.