Don’t forget to push your answers to your remote repository by the end of quiz time. Push all your answers to quiz/3/ folder in your Github project.
1. A Geometric Series is defined by the following mathematical sequence,
A finite version of this sequence can be defined as the following,
a) Write a recursive function that takes an input integer m
and computes the finite Geometric sum as defined above.
b) Write a non-recursive function, using loops, that takes an input integer m
and computes the finite Geometric sum as defined above.
c) Write a third script, for example, named benchmark
, that measures the speed of the above two function implementations for some input test value of m
, and displays a message like the following,
Recursive implementation is 0.76 as fast as the loop-based implementation of the function.