algorithm - How can I convert a function of input size defined recursively into a direct function of problem input size? -
Say I have an algorithm which is running on the input of size n and I know that the time it happens to n, it happens twice. It takes time for N -1 I can see in this simple matter (assuming that, for 1 second, n = 0), that algorithm takes 2 n seconds.
Is there a general method for conversion to more familiar direct type expression in recursive defined definitions?
"recursive work" such as these are called repetition correlation And their "direct type" is known as a close-form solution .
While the master theorem listed by Poeta is very helpful, in computing time-complexity, it is not to have any relation with it in realizing the repetition relations.
And the list of closed forms of some common sections of repetition ( "see also with" ) relationships. However, complex (non-linear) repetition relations can be very difficult to find solutions of closed-forms, if there is one, then there is no general algorithm to solve them.