[algogeeks] Re: Rabin-Karp with 2dimensional arrays

2009-03-21 Thread Miroslav Balaz
It is straightfordward, you must precalculate the partial sums of the text,in each column... I am not sure if i remember correctl what is Rabin-Karp doing, but if sum is just a sum of ascii values, modulo some prime, for that case it works without problem. 2009/3/21, Miroslav Balaz : > 2009/3/21

[algogeeks] Re: Rabin-Karp with 2dimensional arrays

2009-03-21 Thread Miroslav Balaz
2009/3/21, sinan : > > Hi, > > I'm studying on this subject recently. Now I've implemented a java > code which can consume two 2darrays which are a Text(nXn) array and a > Pattern(mXm). > > For now, it translates the pattern to a number which is the sum of the > numbers in the pattern, and looks f

[algogeeks] Rabin-Karp with 2dimensional arrays

2009-03-21 Thread sinan
Hi, I'm studying on this subject recently. Now I've implemented a java code which can consume two 2darrays which are a Text(nXn) array and a Pattern(mXm). For now, it translates the pattern to a number which is the sum of the numbers in the pattern, and looks for the corresponding value in the t

[algogeeks] Sprague-Grundy function of DAG

2009-03-21 Thread Satyam Shekhar
Hi, I was wanted to know if we can do better than O(V*V) to calculate the sprague-grundy values of DAG? We can achieve O(V*V) by topologically sorting the graph and then iterating through the vertices. Is there any known algorithm to improve this? Regards Satyam Shekhar --~--~-~--~