0 to have a value at (n) equal to half the product of all previous values, with P(0″ src=”https://files.transtutors.com/cdn/qimg/4760797343a141388dcbb55302b422e4.jpg” aria-describedby=”gnu”>

4. A function P(n , x) is defined for n > 0 to have a value at (n) equal to half the product of all previous values, with P(0 , x) = x. • Implement a recursive algorithm to compute P(n , x) for any zero or integer value of (n) and give an analysis of the number of multiplications performed by this algorithm. Implement a Dynamic Programming algorithm that uses an array of size (n) and give an analysis of the number of multiplications performed by the algorithm.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *