Lecture 13 - Problem Decomposition
Lecture 13 - Problem Decomposition
Problem Decomposition
13. 1 Introduction
A solution to a large problem is often complex. It can be made simple if the problem is
broken down into smaller parts. Then each part can be solved individually and then the solutions
are combined to produce the solution to the original problem. The process of breaking down a
complex problem or system into smaller sub problems with more manageable parts is known as
Problem Decomposition.
Decomposition helps to solve complex problems and manage large projects.
Large problems can be tackled with “divide and conquer” method
The problem should be decomposed such that every sub problem is of the same level of
detail.
Each sub problem can be solved independently.
The solutions to the sub problems can be combined to solve the original problem.
Example 1: Consider the problem of making a pizza. The task of making a pizza is a considerably
larger task. But it can be subdivided into the following subtasks.
1. Make crust
2. Make spread and sauce
3. Spread cheese
4. Spread toppings
5. Bake
6. Slice
0 1 2 3 4 5 6 7 8 9 10
20 23 15 7 4 8 10 20 40 25 12
0 1 2 3 4 5 6 7 8 9 10
4 7 8 10 12 15 20 20 23 25 40
4 7 8 10 12 15 20 20 23 25 40
Fig. 13.5 Middle Element 15; 25<15; So, left half is discarded
Now, the new low is calculated as low = mid + 1, since the lower half of the list is discarded. If
the upper half is discarded, low will be calculated as low = mid – 1.
So
low = mid+1 = 5+1 = 6
mid = 6 + (10-6)/2 = 6 + 2 = 8
6 7 8 9 10
20 20 23 25 40
Fig. 13. 6 New list
Now the search element is to be searched only in the upper half of the list shown in Fig. 13.6. The
low and middle values are calculated as shown above and the middle element is 23. Since, 25>23,
once again the lower half of the list is discarded and the upper half is considered. The low and
middle values are calculated using the usual formula.
low = mid + 1 = 8 + 1 = 9
mid = low + (high-low)/2 = 9 + (10-9)/2 = 9.5 = 10.
Now the new list is shown in Fig. 13.7.
9 10
25 40