Question: (i) What is meant by Dynamic Programming? Using appropriate diagrams and code snippets, show how the recursive calculation of the Fibonacci sequence f(n) with f(0)

(i) What is meant by Dynamic Programming? Using appropriate diagrams and code snippets, show how the recursive calculation of the Fibonacci sequence f(n) with f(0) = 0 1)-1 ; fin)-t(n-1)" f(n-2) can be greatly improved when the dynamic programming approach is applied. 17) (ii) Consider the following code fragment: public class ArrayStack implements Stack protected int capacity protected static final int CAPACITY-1000;// default array capacity protected Object SI protected int top; // actual capacity of the stack array // array used to implement the stack index for the top of the stack public ArrayStackO Il default constructor: creates stack with default capacity this(CAPACITY); public void push(Object element) if (isFullo) return top++; S[top] = element; Answer the following questions: ArrayStack is a public class. What does this mean in terms of the overall visibility of the class? Why is this a good design decision? [21 All class variables are of type protected. What does this mean in terms of their overall visibility? ArrayStack stores objects of type Object rather than specific types like int or float. Why is this good idea? How is this design decision linked to the concept of an explicit cast as a means to store and retrieve any kind of object types orn such a stack? 13] (iii) What is meant by a self-referential structure type? Provide an example to illustrate your answer 121
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
