Algorithm and Flowchart: Algorithm and Flowchart Presented By, C.B.Anand Kumar M.Tech (CSE)., Lecturer/CSE SMK FOMRA Inst of Tech,Chennai
Algorithm : Algorithm The Term Algorithm refers to the logic of a program. It is a step-by-step description of a solution to the given problem. When sequence of instructions are executed in the specified format and sequence the desired result are obtained. Definition:- A format or set of steps for solving a particular problem is called as algorithm. It has clear starting and stopping point. With specific step by step instructions in each line.
Characteristics of Algorithm: Characteristics of Algorithm Each instruction should be precise and clear. Each instruction should be executed in a finite time. One or more instructions should not be repeated Infinitely. After executing the instructions the desired result are obtained. It range from Simple to the Complex.
Process of algorithm: Process of algorithm An algorithm must express the steps in the solution in a way that will be suitable for computer processing. It Read Value perform a simple procedure and output the required result. After algorithm a Flowchart is prepared and than it is run in the language form in the computer.
Algorithm for finding largest number in the list: Algorithm for finding largest number in the list When you begin the first number is the largest number in the list you’ve seen so far. Look at the next number and compare it with the largest number you’ve seen so far. If the next number is larger than make that the new largest number you’ve seen so far. Repeat step 2 and 3 until you have gone through the whole list.
Flowchart: Flowchart A Flowchart is a pictorial representation of an algorithm. The First flowchart is made by John Von Newman in 1945. It is a symbolic diagram of operation sequence, dataflow, control flow and processing logic in information processing. The symbol used are simple and easy to learn. It is a very help full tool for programmers and beginners.
Purpose of flowchart: Purpose of flowchart Provide Communication. Provide an overview. Show all elements and its relationship. Quick method of showing program flow. Check program logic. Facilitate coding. Provide program revision. Provide Program documentation.
Advantages of flowchart: Advantages of flowchart Communication. Effective analysis. Proper documentation. Efficient coding. Proper debugging. Efficient program maintenance. Easy and clear presentation.
Limitation of flowchart: Limitation of flowchart Complex logic. Drawing is time consuming. Alteration and modification. Redrawn many times. Difficult to draw and remember. Reproduction ( replica ). Technical detail.
Symbols used in flowchart: Symbols used in flowchart All symbols are of different shape and size. All have specific meaning and use. The ANSI ( American National Standard Institute) group categories symbols in 3 types basic, specialized and additional symbols. These institution and standardized these basic symbols for use.
BASIC SYMBOLS: BASIC SYMBOLS Terminal Symbol = for start and stop. INPUT and OUTPUT = Any function of input and output data. Processing = An arithmetic and data movement instruction. Shows mathematical calculation and logic operations.
SYMBOLS CONT..: SYMBOLS CONT.. Decision = Diamond indicate decision point in the program flow. IT may have 2 way branch or 3 way also. Flow Lines = A Straight line between two boxes shows the path of logic flow in the program. An arrow head on the top of the line shows the direction of the flow, data from top to bottom and left to right. Connectors = 2 small circles are used to connect separated portions of a flowchart without drawing lines between the parts. One connector indicated where the flow breaks off the other where it resumes.
Types of flowchart: Types of flowchart System flowchart. Modular program flow chart. Detail program flowchart or application flowchart. Play a vital role in system analysis. Used by system analysts for analyzing or designing system. Represents all elements graphically.
Types of flowchart: Types of flowchart 2. They are designed primarily to illustrate algorithms for developing and writing a specific computer program. In modular each instructions are written in separate modules o r units. This type of flowchart are called block diagram. 3. These are very comprehensive and broad. They are made by practitioners for complex programs very much.
Flowchart to find the average of any 10 numbers: Flowchart to find the average of any 10 numbers Start Count = 0, sum= 0, Avg =0. Read A Sum = Sum + A, Count = Count + 1 1
PowerPoint Presentation: 1 If Count < 10 Yes No Avg = Sum / 10 Print Avg End
Exercise on Flowchart and algorithm: Exercise on Flowchart and algorithm Draw a flowchart and algorithm to add up all the even numbers between 0 to 200 and print the result. Draw a flowchart and algorithm to add up all the odd numbers between 0 to 200 and print the result. Five numbers denoted by the variables A, B, C, D and E are supplied as input. Draw a flowchart and algorithm to print these numbers in descending order of the magnitude.
Exercise on Flowchart and algorithm: Exercise on Flowchart and algorithm 4.Draw a flowchart and algorithm to read and print the first 10 records in a data set. Make sure that the processing stop after the 10 th record. 5. A set of Exam grades of A,B,C,D or E. give total paper of grade A to E separately and total count of all will be printed at the end. 6. To print the name and age of the oldest and youngest student in a class. Input may be name d and age of the students, assumed value may be 83