In Year 2 of a 3-year construction contract, the total estim…
In Year 2 of a 3-year construction contract, the total estimated costs to complete exceeded the contract price, resulting in an estimated loss on the construction contract. Which of the following statements is TRUE regarding recognition of the loss?
Read DetailsBelow you will find the dynamic programming recurrence relat…
Below you will find the dynamic programming recurrence relation that can serve as the basis for a dynamic programming algorithm for solving the problem of finding the -th Fibonacci number . F(n) = 1, if n=1 or 2 = F(n-1) + F(n-2), if n > 2 For each of the four attempts of writing a dynamic programming algorithm for computing the -th Fibonacci number, please match it to its corresponding statement: (i) a correct bottom-up dynamic programming algorithm, (ii) a correct top-down memoized dynamic programming algorithm, (iii) a correct exponential-time algorithm that does not rely on dynamic programming, (iv) an incorrect algorithm for the problem (i.e., an algorithm that provides an incorrect solution to the -th Fibonacci number). Pseudocode options for the dynamic programming algorithm for computing the -th Fibonacci number: Match the pseudocodes to the statements above (a) F: array [1..n] F[1]=F[2]=1for i=3 to n do F[i]=F[i-1]+F[i-2}return F[n] (b) Initialize an array M[1..n] with 0’scall F(n) function F(i) {if M[i] =0 then if (i=1 or i=2) then M[i]=1 else M[i]=F(i-1)+F(i-2) return M[i] } (c) call F(n) function F(i) {if i=1 or i=2, return 1 else return F(i-1)+F(i-2) } (d) Initialize an array M[1..n] with 0’scall F(n) function F(i) {if M[i] >0 then return M[i] else return F(i-1)+F(i-2) }
Read Details