DESIGNING ALGORITHMS

Since the meaning of algorithm and data has been understood,so strategies can be devised for designing algorithms.The following is a useful strategy.

INVESTIGATION STEP:

  1. Identify the ouptut needed.
    This includes the form in which the output have to be presented.At the same time,it has to be determined at what intervals and with what precision the output data needs to be given to user.
  2. Identify the input variable available.
    This activity consider the specific inputs available for this program,the form in which the input variable would  be available,the availability of inputs at different intervals,the ways in which the input would be fed to the transforming process.
  3. Identify the major decisions and conditions.
    This activity looks into the conditions imposed by the need identified and the limitations of the environment in which the algorithm has o be implemented.
  4. Identify the processes required to transform inputs into required outputs.
    This activity identifies the various types of procedures needed to manipulate the inputs,within the  bounding conditions and the limitations mentioned in step 3, to produce the needed outputs.
  5. Identify the environment available
    This activity determines the kind of users and the type of computing machines and software available for implementing the solution through the processes considered in step.

TOP-DOWN DEVELOPMENT STEP:

  1. Devise the overall problem solution by identifying the major components of system.
    The goal is to divide the problem solution into manageable small pieces that can be solved separately.
  2. Verify the feasibility of breaking up the overall problem solution.
    The basic idea here is to check that though each small piece of solution procedure are independent of each other,as they together form the whole solution to problem.In fact,the different pieces of solution procedures have to cooperate and communicate in order to solve the larger problem.

STEPWISE REFINEMENT:

  1. Work out each and every detail for each small piece of manageable solution procedure.
    Every input and output dealt with and the transformation algorithms implemented in each small piece of solution procedure,which is also known as process,is detailed.Even the interfacing details between each small procedure are worked out.
  2. Decompose any solution procedure detailed in step 1 is checked once again.
    If necessary any of these may be further broken up into still smaller pieces of solution procedure till it can no more be divided into meaningful procedure.
  3. Group processes together which have some commonality.
    Some small processes may have to interface with a common upper level process.Such processes may be grouped together if required.
  4. Group variables together which have some appropriate commonality.
    Certain variables of same type may be dealt as elements of a group.
  5. Test each small procedure for its detail and correctness and its interfacing with the other small procedures.
    Walk through each of the small procedures to determine whether it satisfies the primary requirements and would deliver the appropriate outputs.Also,suitable tests have to be carried out to verify the interfacing between various procedures.Hence,the top-down approach starts with a big and hazy goal.It breaks the big goal into smaller components.These components are themselves broken down into smaller parts.This strategy continues until the designer reaches the stage where he or she  has concrete steps that can actually be carried out.
    It has to be noted that the top-down approach does not actually take into account any existing equipment,people or process.It begins with a "clean slate" and obtains the optimal solution.The top-down approach is most appropriate for large and complex projects where there is no existing equipment to worry about.However,if the existing equipment can be made to fit into the new plan with very less effort,it would be beneficial to use it and save cost.

Comments