Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
22 views
37 pages
665780086
Supply an demand elactisity
Uploaded by
oryx.gic
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download
Save
Save 665780086 For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
0 ratings
0% found this document useful (0 votes)
22 views
37 pages
665780086
Supply an demand elactisity
Uploaded by
oryx.gic
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save 665780086 For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
Download
Save 665780086 For Later
You are on page 1
/ 37
Search
Fullscreen
ALGORITHMS AND FLOWCHARTSWhy Algorithm is needed? Programming is both tedious and exciting, Tedious because like spoken languages programming languages also have so many demanding rules. Exciting because writing program provides the programmer with the chance to create something new also gives challenges of solving a problem. It is very difficult to write direct programs in any language, just like you can not start constructing building without the design of building For constructing a building you need design of building, si ilarly for writing a large or good program you need algorithm.Why Algorithm is needed? Programming is both tedious and exciting, Tedious because like spoken languages programming languages also have so many demanding rules. Exciting because writing program provides the programmer with the chance to create something new also gives challenges of solving a problem. It is very difficult to write direct programs in any language, just like you can not start constructing building without the design of building For constructing a building you need design of building, si ilarly for writing a large or good program you need algorithm.Program design Problem | nN | Program Igorithm ¢ Program Design Process has 2 phases: e Problem Solving Phase Creates an algorithm that solves the problem ¢ Implementation (Coding) Phase Translates the algorithm into a programming languageAlgorithms An algorithm is a finite set of steps defining the solution of a particular problem. ° Need not to belong one particular language © Sequence of English statements can also be algorithm © It is not a computer program © An algorithm can be expressed in English like language, called pseudocode, in a programming language or in the form of flowchart.Algorithm Vs Program © What is the difference between an algorithm and a program? O a program is an implementation of an algorithm to be run on a specific computer and operating system. O an algorithm is more abstract — it does not deal with machine specific details — think of it as a method to solve a problem. * What is good algorithm? Efficient algorithms are good, we generally measure efficiency of an algorithm on the basis of: 1. Time: algorithm should take minimum time to execute. 2. Space: algorithm should use less memory.Algorithm Specification Every algorithm must satisfy the following criteria: ° Input. Zero or more quantities are externally supplied. © Output. At least one quantity is produced. © Definiteness. Each instruction must be clear and unambiguous(Unique meaning). ¢ Finiteness. An algorithm terminates in a finite number of steps. ¢ Effectiveness. Every instruction must be basic enough to be carried out than, means not so complex.Pseudo code Pseudocode is one of the methods that could be used to represent an algorithm. It is not written in a specific syntax that is used by a programming language and therefore cannot be executed in a computer. There are lots of formats used for writing pseudocodes and most of them borrow some of the structures from popular programming languages such as C, Lisp, FORTRAN, etc. Also, natural language is used in Pseudocode when presenting details that are not important. Most of the algorithms are presented using pseudocode since they can be read and understood using programmers who are familiar with different programming languages. Some programming constructs used for Pscudo Code — READ, PRINT, SET, INITIALISE, INCREMENT, IF -THEN — ENDIF, IF — THEN — ELSE — ENDIF,REPEAT — UNTIL, DO — WHILE ete.What is the difference between Algorithm and Pseudocode? An algorithm is a well defined sequence of steps that provides a solution for a given problem, while a pseudocode is one of the methods that can be used to represent an algorithm. © While algorithms can be written in natural language, pseudocode is written in a format that is closely related to high level programming language structures. ° But pseudocode does not use specific programming language syntax and therefore could be understood by programmers who are familiar with different programming languages. Additionally, transforming an algorithm presented in pseudocode to programming code could be much easier than converting an algorithm written in natural language.Informal definition of an algorithm Input List Algorithm Output ListFinding the largest integer among five integers Input List FindLargest oe Ce) ooo Sept - a - . Step 2 ae Output ResultDefining actions in Find Largest algorithm — FindLargest Step 1 (| ae ‘Output ResultIKE ees Ny REPRESENTATIONExample-1 Pseudocode © Step 1: Input W,L © Step 2: AM@LxW © Step 3: Print AExample-2 Input M1.M2,.M3,M4 AYGm(MI+M24M34M4)/4 1s y AVG
N2) then if (NI>N3) then MAX # NI else MAX mN3 endif else if (N2>N3) then MAX m N2 else MAX wm N3 endif endif //{N1>N2, NI>N3] //{N3>NI>N2] //[N2>N1, N2>N3] //{N3>N2>N1] Step 3: Print “The largest number is”, MAXFlowchart A graphical representation of an algorithm, often used in the design phase of programming to work out the logical flow of a program. ° Visual way to represent the information flow © Make our logic more clear ° Help during writing of program ° Make testing and debugging easyName Symbol Flow line ———_ > Paralletogram Rectangle ‘Use in flowchart Denotes the beginning or end of a program. Denotes the direction of logic flow in @ program. Denotes either an input operation (e.g., INPUT) ‘oF an output operation (e.g, PRINT). Denotes a process to be carried out (eg., an addition). Denotes a decision (or branch) to be made. The Program should continue along one of two routes (eg., IFTHEN/ELSE).Flowchart or program constructs | Sequence: The order of execution, this typically refers to the order in which the code will execute. Normally code executes line by line, so line 1 then 2 then 3 and so on. Selection: Selection, like branching, is a method of controlling the execution sequence, you can create large control blocks, using if statements testing a condition, or switch statements evaluating a variable etc to control and change the execution of the program depending on this environment and changing variables, Iteration (Repetition): Iteration is typically used to refer to collections and arrays of variables and data. Repeating set of instruction. Counting from 1 to 10, you are iterating over the first 10 numbers, for, while, do-while loops will be implemented for iteration.Flowchart Constructs SequenceFlowchart Constructs (cont..) Repetition yes No ey =Flowchart Constructs (cont..) Repetition yes No ey =Example-1 Pseudocode © Step 1: Input W,L © Step 2: AM@LxW © Step 3: Print AExample-1 Pseudocode © Step 1: Input W,L © Step 2: AM@LxW © Step 3: Print AExample-2 Input M1.M2,.M3,M4 AYGm(MI+M24M34M4)/4 1s y AVG
N2) then if (NI>N3) then MAX # NI else MAX mN3 endif else if (N2>N3) then MAX m N2 else MAX wm N3 endif endif //{N1>N2, NI>N3] //{N3>NI>N2] //[N2>N1, N2>N3] //{N3>N2>N1] Step 3: Print “The largest number is”, MAXExample 5 Step 1: Input N1,N2,N3 Step 2: if (NI>N2) then if (NI>N3) then MAX # NI else MAX mN3 endif else if (N2>N3) then MAX m N2 else MAX wm N3 endif endif //{N1>N2, NI>N3] //{N3>NI>N2] //[N2>N1, N2>N3] //{N3>N2>N1] Step 3: Print “The largest number is”, MAX/ Flow Charts Limitation © For very large program, flow chart goes for many pages Costly to draw flow charts for large program Difficult to modify
You might also like
Lecture-2.3-Flowchart Algorithm Pseudocode
PDF
No ratings yet
Lecture-2.3-Flowchart Algorithm Pseudocode
21 pages
Algorithm and Flowchart
PDF
100% (1)
Algorithm and Flowchart
37 pages
Pseudocode, Algorithm & Flowchart
PDF
No ratings yet
Pseudocode, Algorithm & Flowchart
34 pages
Principles of Programming
PDF
No ratings yet
Principles of Programming
120 pages
Algorithm and Flowcharts
PDF
No ratings yet
Algorithm and Flowcharts
4 pages
2-Algo and Flow Chart
PDF
No ratings yet
2-Algo and Flow Chart
17 pages
Flowchart and Pseudocode-2 and 3
PDF
100% (1)
Flowchart and Pseudocode-2 and 3
20 pages
Flowchart PDF
PDF
No ratings yet
Flowchart PDF
29 pages
Module 2 Q and Answers
PDF
No ratings yet
Module 2 Q and Answers
13 pages
Unit 1
PDF
No ratings yet
Unit 1
31 pages
1 Algorithm Pseudocode Flowchart
PDF
No ratings yet
1 Algorithm Pseudocode Flowchart
32 pages
Algorithms and Flowchart
PDF
No ratings yet
Algorithms and Flowchart
27 pages
3 Algorithm and Flowchart 150823203936 Lva1 App6892
PDF
No ratings yet
3 Algorithm and Flowchart 150823203936 Lva1 App6892
37 pages
Lecture 4.1 Algorithms and Flowcharts
PDF
No ratings yet
Lecture 4.1 Algorithms and Flowcharts
24 pages
Algorithms and Flowchart
PDF
No ratings yet
Algorithms and Flowchart
28 pages
Introduction To Computer
PDF
No ratings yet
Introduction To Computer
26 pages
Unit 2 - Activity 9 - Algorithm and Flowchart Reading and Assignment
PDF
No ratings yet
Unit 2 - Activity 9 - Algorithm and Flowchart Reading and Assignment
31 pages
Comp App PDF
PDF
No ratings yet
Comp App PDF
38 pages
Algorithms and Flowcharts
PDF
No ratings yet
Algorithms and Flowcharts
19 pages
Buratutosd 1123 BSIT
PDF
100% (1)
Buratutosd 1123 BSIT
40 pages
Algorithm Pseudocode Flowcharts
PDF
100% (1)
Algorithm Pseudocode Flowcharts
32 pages
Unit 1.2 Algorithms-and-Flowchart
PDF
No ratings yet
Unit 1.2 Algorithms-and-Flowchart
29 pages
PF Lec1 Introduction
PDF
No ratings yet
PF Lec1 Introduction
47 pages
Lecture 2 Problem Solving Techniques Algorithims
PDF
No ratings yet
Lecture 2 Problem Solving Techniques Algorithims
47 pages
Module 1
PDF
No ratings yet
Module 1
79 pages
Problem Solving: Algorithms and Flowcharts: CSC 110-Introduction To Computer Systems
PDF
No ratings yet
Problem Solving: Algorithms and Flowcharts: CSC 110-Introduction To Computer Systems
19 pages
Algo and Flowchart
PDF
No ratings yet
Algo and Flowchart
32 pages
2-Problem Solving Techniques
PDF
No ratings yet
2-Problem Solving Techniques
25 pages
Algorithm Defination Design Implementation
PDF
No ratings yet
Algorithm Defination Design Implementation
7 pages
Algorithms and Flowcharts
PDF
No ratings yet
Algorithms and Flowcharts
28 pages
Algo and Flowchart
PDF
No ratings yet
Algo and Flowchart
32 pages
Algorithms
PDF
No ratings yet
Algorithms
10 pages
Lec3 - Algorithms and Flowcharts
PDF
No ratings yet
Lec3 - Algorithms and Flowcharts
25 pages
Unit 1 - Python Programming
PDF
No ratings yet
Unit 1 - Python Programming
19 pages
Programming1 Lecture Presentations
PDF
No ratings yet
Programming1 Lecture Presentations
124 pages
Flowchart Excerise Answers 2
PDF
No ratings yet
Flowchart Excerise Answers 2
41 pages
1A. Algorithms and Flowcharts
PDF
No ratings yet
1A. Algorithms and Flowcharts
30 pages
L-14.1 Flowchart Algorithm Pseudocode
PDF
No ratings yet
L-14.1 Flowchart Algorithm Pseudocode
21 pages
Notation (Pseudo Code, Flow Chart)
PDF
No ratings yet
Notation (Pseudo Code, Flow Chart)
51 pages
Chapter 2: Algorithm Chapter 2: Algorithm: by The End of This Chapter, Students Should Be Able To
PDF
No ratings yet
Chapter 2: Algorithm Chapter 2: Algorithm: by The End of This Chapter, Students Should Be Able To
39 pages
Lecture 4
PDF
No ratings yet
Lecture 4
21 pages
L05!06!07 ProblemSolving
PDF
No ratings yet
L05!06!07 ProblemSolving
76 pages
Flow Charts, Algorithm, Pseudo Code
PDF
No ratings yet
Flow Charts, Algorithm, Pseudo Code
54 pages
Lect1 Algorithms and Flowchart
PDF
No ratings yet
Lect1 Algorithms and Flowchart
29 pages
Computer Science: Covered Basics About Algorithms and Flowcharts
PDF
No ratings yet
Computer Science: Covered Basics About Algorithms and Flowcharts
31 pages
FLOWCHART
PDF
No ratings yet
FLOWCHART
17 pages
CMP 102 Introduction To CP Module 6 Pseudocodes and Flowcharts
PDF
No ratings yet
CMP 102 Introduction To CP Module 6 Pseudocodes and Flowcharts
31 pages
1.week 01 Introduction 01042020 101459pm 04032021 030938pm
PDF
No ratings yet
1.week 01 Introduction 01042020 101459pm 04032021 030938pm
48 pages
Procedrual Programming Unit-1-5A
PDF
No ratings yet
Procedrual Programming Unit-1-5A
46 pages
1-Introduction To Algorithms-Flowcharts-Pseudocodes
PDF
No ratings yet
1-Introduction To Algorithms-Flowcharts-Pseudocodes
31 pages
Introduction To Problem Solving
PDF
No ratings yet
Introduction To Problem Solving
13 pages
UNIT 1 - Program Logic Development
PDF
No ratings yet
UNIT 1 - Program Logic Development
36 pages
Algorithm, Pseudocode, Flowchart What Is An Algorithm?
PDF
100% (1)
Algorithm, Pseudocode, Flowchart What Is An Algorithm?
7 pages
Lect1 Algorithms and Flowchart
PDF
No ratings yet
Lect1 Algorithms and Flowchart
62 pages
Lecture 1 - B - Algorithms-and-Flowchart - Tutorial
PDF
No ratings yet
Lecture 1 - B - Algorithms-and-Flowchart - Tutorial
26 pages
02 EKH Algorithm Flowchart Complexity Lecture
PDF
No ratings yet
02 EKH Algorithm Flowchart Complexity Lecture
12 pages
Flowcharts&Pseudocode
PDF
No ratings yet
Flowcharts&Pseudocode
27 pages
Algorithms and Flowcharts
PDF
No ratings yet
Algorithms and Flowcharts
31 pages
Algorithm-Pseudocode and Flowchart
PDF
No ratings yet
Algorithm-Pseudocode and Flowchart
22 pages