Sie sind auf Seite 1von 2

c 

 2    
 

 



   

     
      
 
 

    
  
    
    
   
 
   


?  
 

The primary objective in computational problem-solving is to develop a correct
and efficient computer program for solving the problem at hand. In this chapter we
will illustrate how, given a problem definition, a precise algorithm and program
implementation can be developed, in a step-wise manner, from an   of the
solution using a powerful method called  
   or  
.
The objective of the design methodology is to first establish the overall structure
and the relationships between the various parts of the problem, and then address
the specific and complex issues of the implementations of the various sub-parts.

The main phases of computer based problem solving are:

x 
  

which identifies the basic principle by which the input can be transformed to
the output and gives an outline of the solution.
    


 
which makes precise the outline indicated, identifies the various components
required and gives a precise method of computing the solution. A crucial
aspect in algorithm design is the analysis of correctness and efficiency.
  

which involves an implementation of the algorithm using the syntax of a
programming language.

We have already seen an example of step-wise refinement in Example 3.13. The


problem of deciding whether a given positive integer is a perfect number or not
was decomposed into many sub-problems; and separate functional algorithms were
then written for each of those. The main idea behind the decomposition strategy is
not merely to divide a program into parts, but to ensure that each sub-problem
accomplishes a clearly identifiable task and is written as a separate function or
procedure which can then be used as a module to define other functions. For

example, the function was defined in terms of the function ,

and while describing the function we were able to regard as

a black-box. Thus the actual design of the function could be


postponed till later and we were only concerned with what it computes and not
how it computes. Thus, as far as the function is concerned,
is not really a procedure but a   
 . Procedural abstraction is an
integral part of step-wise refinement and it allows program development in a
modular and systematic fashion.

Das könnte Ihnen auch gefallen