[This page is auto-generated; please prefer to read the article’s PDF Form.]
Having estimated the work required by a subproblem, we will now try to find out the optimal sizes of the two subproblems. For this analysis, assume n to be even. So, the subproblems’ sizes can also be expressed as (n∕2 − a) and (n∕2 + a), for some a with 0 ≤ a < n∕2. The work required to solve the two subproblems is:
|
We assume that the work required to create the two subproblems and combine their results remains same, whatever be the two subproblems’ size distribution. So, to minimize the total work required for the size n problem, we want to pick a which minimizes w(a). Consider the value of f at (n∕2 − a) and n∕2. Due to the Mean Value Theorem from Differential Calculus, we know that there must exist b1 in interval (n∕2 − a,n∕2) such that:
| (1) |
(Note that although n∕2 and a are integers, but b1 need not be one.) Similarly, there must exist b2 in interval (n∕2,n∕2 + a) such that:
| (2) |
As b1 ≤ b2, so due to property (2) of f, f′(b1) ≤ f′(b2). As a ≥ 0, f′(b1)a ≤ f′(b2)a. Thus, equations (1) and (2) imply:
So, we should pick a = 0 to minimize w(a). That means to choose the two subproblems sizes as n∕2 each. Note that, although we are interested in values of f only at integers, but we could bring in Differential Calculus as a useful tool.
Copyright © 2021 Nitin Verma. All rights reserved.