Question: On a stack composed of n> 0 blocks, we apply the following unstacking recursive algorithm: (i) Split the stack into two smaller stacks of
On a stack composed of n> 0 blocks, we apply the following unstacking recursive algorithm: (i) Split the stack into two smaller stacks of sizes n1 > 0 and n2 > 0 with ni +n2 = n. (ii) Compute the score of this operation as s1 = nin2. (iii) Reiterate (i) and (ii) on the small stacks until you get stuck (cannot split anymore). Compute the total score as the sum of all the scores obtained in (ii). Prove that every way of unstacking a stack of n blocks gives the same total score: S, = )
Step by Step Solution
3.48 Rating (155 Votes )
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
