# Thread: dynamic programming

1. ## dynamic programming

Hi guys, what's up?
I would like to ask whenever I have replicated recursive call (meaning the same recursive call called for instance twice), why the time complexity of it is bigger than the time complexity if we do a recursive call in a dynamic programming(meaning having an array and storing the called recursive call to read it again if being called)

** intuitive if we are not having an array to store the replicated recursive call then implicitly I must do double work (double time) to get the data unlike if I have an array that's already stored my data ....but how would I know that the time for getting data from array is lesser than having a recursive call?! ***

In other words, why eliminating replicated recursive call is mandatory for decreasing the time complexity?!

thanks guys!

2. Originally Posted by RyanC
but how would I know that the time for getting data from array is lesser than having a recursive call
Arrays are regarded as having random access, i.e., accessing an element of an array by index is regarded as taking constant time.

In reality it can be more complex than that, but complexity analysis (ironically?) simplifies that complexity. If you really need to know in practice, measure the timings with typical test data.

3. Originally Posted by laserlight
If you really need to know in practice, measure the timings with typical test data.
But that would require that he actually writes a program, something I've never see him do! He just asks strange, usually totally obvious, questions.

4. Originally Posted by laserlight
Arrays are regarded as having random access, i.e., accessing an element of an array by index is regarded as taking constant time.

In reality it can be more complex than that, but complexity analysis (ironically?) simplifies that complexity. If you really need to know in practice, measure the timings with typical test data.
Got you, and you mean by constant time which PC can get implicitly the data faster than a recursive way ye?! thanks

5. Originally Posted by bruteforce
But that would require that he actually writes a program, something I've never see him do! He just asks strange, usually totally obvious, questions.
Excuse me? I guess that my question on point, secondly the forum isn't for writing my code over but it's helping what's bugging you while coding/writing code. thanks for your comment btw.
thirdly, when you're coding something it's more amazing if you know about how optimal(int terms of time) your code is !

6. Originally Posted by RyanC
Excuse me? I guess that my question on point, secondly the forum isn't for writing my code over but it's helping what's bugging you while coding/writing code. thanks for your comment btw.
thirdly, when you're coding something it's more amazing if you know about how optimal(int terms of time) your code is !
Excuse you? There is no excuse for you! You sound like a total moron to me, and to most other people here by the looks of it. Try actually writing a program some day!!!

7. Originally Posted by RyanC
and you mean by constant time which PC can get implicitly the data faster than a recursive way ye?
No, that's not what constant time means. You asked a question about time complexity, so either you have already read up on what constant time means, or you need to do so rather than be spoonfed.

Popular pages Recent additions