Analysis of algorithms is a form of mathematics. Consider the following problem:
• We assume that a pair of squirrels has a pair of children every year.
• These children are too young to have children of their own until two years later.
• Squirrels never die.
(The last assumption sounds stupid, but makes the problem simpler. After we have analyzed the simpler version, we could go back and add an assumption e.g. that squirrels die in ten years, but it wouldn't change the overall behavior of the problem very much. However students who consider this case as well, will earn extra marks!)
1. Express the number of pairs of squirrels as a function P(n) of time (n is time measured as a number of years since the start of the experiment).
2. Develop an algorithm to compute P (n).
3. Use you program to calculate P(25) and P(250). Report and comment both results and execution times.
4. What is the time complexity of your algorithm, in Big-O notation? Explain why.
How can I solve this problem?