Menu

(Solved) : Given Sequence N Numbers A1 A2 One Step Erase Number Except Leftmost Rightmost Ones Eras Q27174447 . . .

You are given a sequence of n numbers A = (a1, a2, …, an). Atone step, you can erase any number except for the leftmost and therightmost ones. Erasing number ai costs ai−1 ∗ ai+1. Your goal isto erase all the numbers ai where 1 < i < n, in some order,such that the total cost is minimized. Give an algorithm toaccomplish your goal, with O(n^3 ) time complexity

Expert Answer


Answer to Given Sequence N Numbers A1 A2 One Step Erase Number Except Leftmost Rightmost Ones Eras Q27174447 . . .

OR