Dale - Computer Science Illuminated 179

# Dale - Computer Science Illuminated 179 - into modules Well...

This preview shows page 1. Sign up to view the full content.

152 Chapter 6 Problem Solving and Algorithm Design Figure 6.5 An example of top-down design Main module (Main program) Level 1 Level 0 Level 3 Level 2 Abstract Particular Top Bottom modules at a lower level. These modules are the basic building blocks of our algorithm. The goal of dividing our problem into subproblems, modules, or segments is to be able to solve each module fairly independently of the others. In a computing context, one module could read data values, another could sum the values, another could print the sum, while still another compares the sum to the previous week’s totals. The design tree contains successive levels of refinement (see Figure 6.5). The top, or level 0, is our functional description of the problem; the lower levels are our successive refinements. So how do we divide the problem
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: into modules? Well, let’s think for a moment how humans usually approach any big problem. We spend some time thinking about the problem in an overall sort of way, then we jot down the major steps. We then examine each of the major steps, filling in the details. If we don’t know how to accomplish a specific task, we go to the next one, planning to come back and take care of the one we skipped later when we have more information. What are we doing? We are dividing the problem into subproblems; we are using the divide-and-conquer strategy. This is exactly the process you should be using in designing an algo-rithm. Write down the major steps. This then becomes your main module....
View Full Document

## This note was uploaded on 01/13/2011 for the course CSE 1550 taught by Professor Marianakant during the Fall '10 term at York University.

Ask a homework question - tutors are online