preprocessing is not at all a bad thing.There are certain problems where you
can avoid TLE by preprocessing only.Examples include doing RMQ.
But for this particular problem you are solving for all possible test cases
only few of which actually occur,Moreover there is no big advantage drawn
from precalculating the values here.Two problems that i remember where i
avoided TLE by the same are happy numbers -II and MRECMAN.There are
definitely many more.The key is use preprocessing if the number of testcases
are large compared to the domain of test cases and there is a pattern among
the different inputs that may be possible.For example the factorial
problem.Each solution can be obtained in o(1) time if the solution to its
successor is known.We can use preprocessing there,

On Wed, Jun 8, 2011 at 12:50 PM, kartik sachan <kartik.sac...@gmail.com>wrote:

> thanks lego............but why preprocessing all time avoided??
> any drawback of it?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Saurabh Singh
B.Tech (Computer Science)
MNNIT ALLAHABAD

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to