Flowcharts & Algorithms

Prince Patel
By -
0

Flowcharts & Algorithms

INTRODUCTION:

In this Article, we learn about computer fundamentals. In this article we have discussed tools which can be used to develop logic of program before writing any program. Flowcharts & Algorithms are example of such tools , which are used for development of software in C & C++. These provides convenience in development of programs.

PROBLEM SOLVING TECHNIQUES:

The problem solving techniques is used for solving of the problem. When any problem require to solve with help of computer programming language, computer cannot solve this problem by its own way, it require to follow following steps or factors.
  1. Problem definition
  2. Analysis of problem
  3. Find out input and output if require
  4. Choose appropriate tools to solve problem (algorithm or flowchart)
  5. Choose appropriate control structure for developing program( code design)
  6. Run and debug the program ( error finding )
  7. Verify the output as per definition
Let us start first with flowchart, how to develop logic of program.

FLOWCHART:

A Flowchart is graphical or diagrammatical representation of sequence of any problem to be solved by computer programming language. It is used to prepare first before writing any program. It is also used to correct and debug a program flow after coding part is completed. Through flowchart it is easy to understand the logic and sequence of problem. After drawing flowchart it becomes easy to write any program. There are various standard symbols available to represent logic of problem which are:

List of Flowchart Example:

  1. Draw a flowchart to find sum of two number.
  2. Draw a flowchart to find area of rectangle.
  3. Draw a flowchart to find average of three subject marks.
  4. Draw a flowchart to find maximum number from two numbers.
  5. Draw a flowchart to find  whether given number is Even or Odd.
  6. Draw a flowchart to find maximum number from three numbers.
  7. Draw a flowchart to find  root of equation: ax2 + bx + c.
  8. Draw a flowchart to reverse given number.
  9. Draw a flowchart to find factorial of given number: f= 1 X 2 X 3 X ...... X N.
  10. Draw a flowchart to find  power and base.
  11. Draw a flowchart to find  sum of 10 elements read from user.
  12. Draw a flowchart to find  maximum number from N different number.
  13. Draw a flowchart to generate fibonacci series upto given term.

    ALGORITHM:

    An algorithm is a finite sequence of well defined steps or operations for solving a problem in systematic manner. These are rules for solving any problems in proper manner. Instruction are written in the natural language. It is also called step by step solution.

    Types of algorithm:

    There are various types algorithm techniques exists, according to types of problem appropriate types of algorithm used.
    1. divide and conquer
    2. greedy method
    3. branch and bound
    4. recursion
    5. effectiveness
    • Divide and conquer: The divide and conquer technique is used to solve complex problem easily. Complex problems are decomposed into several step, which make problem easy to solve.
    • Greedy method: This method is used to solve optimization problem. With several possible solution one best solution is selected with help of this method.
    • Branch and bound: when there are several statement or certain part of logic repeated this type of concept is used. A branch and bound algorithm computes a number(bound) at a node to determine whether the node is promising.
    • Recursion: when procedure call itself is called recursion.
    • Effectiveness: All operations can be carried out in predefined time and sequence.

    List of algorithm Example:

    1. Write an algorithm to find out sum of two numbers.
    2. Write a algorithm to find out are of square.
    3. Write an algorithm to find average of three numbers.
    4. Write an algorithm to find whether given number is positive or negative.
    5. Write an algorithm to find out minimum number from three input numbers.
    6. Write an algorithm to find factorial of given number
    7. Write an algorithm to reverse given number.
    8. Write an algorithm to solve following series 1! + 2! + 3! + ... +n!
    9. Write an algorithm to find whether given number is armstrong or not.
    10. Write an algorithm to find maximum number from n numbers.
    11. Write an algorithm to generate Fibonacci series up to given term 1 1 2 3 5 8 13.....
    12. Write an algorithm to store sum of 10 different numbers.
    13. Write an algorithm to find whether given number is prime or not.
    14. Write an algorithm to find occurrence of given number from different numbers by using array.

      PSEUDO CODE:

      It is language or part of language used to convert program into easy form. It allows the programmer to write logic of flowchart or algorithm in symbolic form. Pseudo means code refer to set of instruction written in a programming language. Hence, pseudo code is a limitation of actual computer instruction without referring to any specific compiler or programming language.
      The pseudo code normally consists of phrases of English language to describe the logic steps of a programming module. It does not occupy any space at a time of compiling or assembling.

      Pseudo code can be used for following situation.
          1. Storage declaration
          2. Assignment of any value.
          3. Procedure call
          4. Input/output
          5. Constant value

      Post a Comment

      0Comments

      Post a Comment (0)