0% found this document useful (0 votes)
23 views18 pages

Emailing ALGORITHM AND FLOW CHART

The document discusses algorithms and flowcharts. It defines algorithms as sequences of steps to solve problems and gives properties of algorithms like being finite and unambiguous. It also explains the different types of control structures in algorithms like sequence, branching, and loops. Finally, it describes flowcharts and their basic symbols for representing algorithms visually.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views18 pages

Emailing ALGORITHM AND FLOW CHART

The document discusses algorithms and flowcharts. It defines algorithms as sequences of steps to solve problems and gives properties of algorithms like being finite and unambiguous. It also explains the different types of control structures in algorithms like sequence, branching, and loops. Finally, it describes flowcharts and their basic symbols for representing algorithms visually.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

Engineering Programming 1

z
ALGORITHM AND
FLOW CHART
z
INTRODUCTION
▪ Basic intelligence covers day to day problem solving and making
strategies to handle different situations which keep arising in day to
day life.

▪ One person goes Bank to withdraw money. After knowing the


balance in his account, he/she decides to with draw the entire
amount from his account but he/she has to leave minimum balance
in his account. Here deciding about how much amount he/she may
with draw from the account is one of the examples of the basic
intelligence.

▪ During the process of solving any problem, one tries to find the
necessary steps to be taken in a sequence. In this Unit you will
develop your understanding about problem solving and approaches.
z
PROBLEM SOLVING

▪ Can you think of a day in your life which goes without problem
solving? Answer to this question is of course, No.

▪ In our life we are bound to solve problems.

▪ In our day to day activity such as purchasing something from a


general store and making payments, depositing fee in school, or
withdrawing money from bank account. All these activities
involve some kind of problem solving.

▪ can be said that whatever activity a human being or machine do


for achieving a specified objective comes under problem solving.
z
ALGORITHM

▪ Algorithm can be defined as: “A sequence of activities to be


processed for getting desired output from a given input.”

▪ Webopedia defines an algorithm as: “A formula or set of steps


for solving a particular problem. To be an algorithm, a set of
rules must be unambiguous and have a clear stopping point”.

▪ There may be more than one way to solve a problem, so there


may be more than one algorithm for a problem.
z
ALGORITHM

▪ Now, if we take definition of algorithm as: “A sequence of


activities to be processed for getting desired output from a given
input.” Then we can say that:

1. Getting specified output is essential after algorithm is executed.

2. One will get output only if algorithm stops after finite time.

3. Activities in an algorithm to be clearly defined in other words for


it to be unambiguous.
z
ALGORITHM

▪ Before writing an algorithm for a problem, one should find out


what is/are the inputs to the algorithm and what is/are expected
output after running the algorithm.
z
Type of Algorithms

▪ The algorithm and flowchart, classification to the three types of


control structures. They are:

1. Sequence

2. Branching (Selection)

3. Loop (Repetition)
z
Type of Algorithms

▪ The sequence is exemplified by sequence of statements place


one after the other – the one above or before another gets
executed first. In flowcharts, sequence of statements is usually
contained in the rectangular process box.

▪ The branch refers to a binary decision based on some condition.


If the condition is true, one of the two branches is explored; if the
condition is false, the other alternative is taken. This is usually
represented by the ‘if-then’ construct in pseudo-codes and
programs. In flowcharts, this is represented by the diamond-
shaped decision box.
z
Type of Algorithms

▪ The loop allows a statement or a sequence of statements to be


repeatedly executed based on some loop condition. It is
represented by the ‘while’ and ‘for’ constructs in most
programming languages. In the flowcharts, a back arrow hints
the presence of a loop. A trip around the loop is known as
iteration. You must ensure that the condition for the termination
of the looping must be satisfied after some finite number of
iterations, otherwise it ends up as an infinite loop.
z
Properties of algorithm

▪ Donald Ervin Knuth has given a list of five properties for an algorithm, these
properties are:

1. Finiteness: An algorithm must always terminate after a finite number of


steps. It means after every step one reach closer to solution of the
problem and after a finite number of steps algorithm reaches to an end
point.

2. Definiteness: Each step of an algorithm must be precisely defined. It is


done by well thought actions to be performed at each step of the
algorithm.

3. Input: Any operation you perform need some beginning value/quantities


associated with different activities in the operation. So the value/quantities
are given to the algorithm before it begins.
z
Properties of algorithm

4. Output: One always expects output/result (expected


value/quantities) in terms of output from an algorithm. The
result may be obtained at different stages of the algorithm. If
some result is from the intermediate stage of the operation then
it is known as intermediate result and result obtained at the end
of algorithm is known as end result.

5. Effectiveness: Algorithms to be developed/written using basic


operations. Actually operations should be basic, so that even
they can in principle be done exactly and in a finite amount of
time by a person, by using paper and pencil only.
z
FLOWCHART

▪ The flowchart is a diagram which visually presents the flow of data


through processing systems.

▪ This means by seeing a flow chart one can know the operations
performed and the sequence of these operations in a system.

▪ Algorithms are nothing but sequence of steps for solving problems.


So a flow chart can be used for representing an algorithm.

▪ A flowchart, will describe the operations (and in what sequence) are


required to solve a given problem. Y

▪ ou can see a flow chart as a blueprint of a design you have made


for solving a problem.
z
Flowchart Symbols

▪ There are 6 basic symbols commonly used in flowcharting of


assembly language Programs:

▪ Terminal;

▪ Process;

▪ input/output;

▪ Decision;

▪ Connector and Predefined Process.


Symbol Name Function

Indicates any type of internal operation inside the Processor


Process
or Memory

Used for any Input / Output (I/O) operation. Indicates that


the computer is to obtain data
input/output
or output results

Used to ask a question that can be answered in a binary


format (Yes/No, True/False)
Decision

Allows the flowchart to be drawn without intersecting lines


or without a reverse flow.
Connector

Predefined Process Used to invoke a subroutine or an Interrupt program.

Indicates the starting or ending of the program, process, or


Terminal interrupt program

Flow Lines Shows direction of flow.


z
General Rules for flowcharting

1. All boxes of the flowchart are connected with Arrows. (Not lines)

2. Flowchart symbols have an entry point on the top of the symbol


with no other entry points. The exit point for all flowchart symbols
is on the bottom except for the Decision symbol.

3. The Decision symbol has two exit points; these can be on the
sides or the bottom and one side.

4. Generally a flowchart will flow from top to bottom. However, an


upward flow can be shown as long as it does not exceed 3
symbols.
z
General Rules for flowcharting

5. Connectors are used to connect breaks in the flowchart.


Examples are:
▪ From one page to another page.

▪ From the bottom of the page to the top of the same page.

▪ An upward flow of more then 3 symbols

6. Subroutines and Interrupt programs have their own and


independent flowcharts.
z
General Rules for flowcharting

7. All flow charts start with a Terminal or Predefined Process (for


interrupt programs or subroutines) symbol.

8. All flowcharts end with a terminal or a contentious loop.

9. Flowcharting uses symbols that have been in use for a number


of years to represent the type of operations and/or processes
being performed.
z

THANK YOU

You might also like