SlideShare a Scribd company logo
What is Algorithm
Programmer’s model of a computer
algorithms
 In programming, algorithm is a set of well defined
instructions in sequence to solve the problem.
 The correct sequence of instructions needed to
solve the corresponding problem.
 The term algorithm refers to the logic of a
program.
 It is a step by step description of how to arrive at
a solution to a given problem.
Characteristics
 Each instruction should be precise and
unambiguous.
 Each instruction should be executed in a finite
time.
 No instruction should repeat infinitely. This
ensures that the algorithm terminates ultimately.
 After executing the instructions (when the
algorithm terminates), the desired results are
obtained.
Sample Algorithm
 Problem1 :
 Fifty students in a class appeared in their final
examination. The division column of their mark
sheets contains the division(FIRST, SECOND,
THIRD or FAIL) obtained by them. If their mark
sheets are available with you, write an algorithm
to calculate and print the total number of students
who in FIRST division.
Algorithm Step
 Step 1: Initalize Total_First_Division and
Total_Marksheets_Checked to zero.
 Step 2: Take the mark sheet of the next student.
 Step 3: Check the division column of the mark sheet
to see if it is FIRST. If no, go to Step 5.
 Step 4: Add 1 to Total_First_Division.
 Step 5: Add 1 to Total_Marksheets_Checked.
 Step 6: Is Total_Marksheets_Checked=50?. If no,go
to Step 2.
 Step 7: Print Total_First_Division.
 Step 8 : Stop
Representation of Algorithm
 Commonly used ways to represent an algorithm are :
 As program
 As flowchart
 As pseudocode
Flow Chart
 A Flowchart is a pictorial representation of an
algorithm.
 Programmers often use it as a program-planning tool
for visually organizing a sequence of steps necessary
to solve a problem using a computer.
 It uses boxes of different shapes to denote different
types of instructions.
 Programmers write actual instructions within these
boxes using clear and concise statements.
 Direct solid lines connecting these boxes indicate flow
of operations – sequence in which to execute the
instructions.
 The process of drawing a flowchart for an algorithm is
known as flowcharting.
WHY USE FLOWCHARTS?
 Normally two steps 1. Algo 2. flowchart for preparing
program.
 Advantage of two steps approach in program writing
is that
 Programmer can concentate fully on the logic of the
solution to the problem at hand, without paying
attention to the syntax and other details of the
programming language.
 Flow chart shows the flow of operations in pictorial
form, a programmer can detect any error in the logic
with greater ease than in the case of a program.
 Once the flowchart is ready, the programmer can
concentrate on coding the operations in each box of
the flowchart as statements of the programming
language.
FLOWCHART SYMBOLS
 A flowchart uses boxes of different shapes to denote
different types of instructions.
 The use of symbols having standardized meanings
makes it easier to communicate program logic
through flowcharts.
Terminal Input/Output Processing
Decision Flow lines Connectors
 Terminal
 Input/Output
 Processing
 Decision
 Flow lines
 Connectors
Sample Flowchart
 1. A student appears for an examination
consisting of total 10 subjects with each subject
having maximum marks of 100. The student’s roll
number, name and marks obtained by him/her in
various subjects are input data.Such a collection
of related data items, treated as a unit, is known
as a record. Draw a flowchart for the algorithm to
calculate the percentage marks obtained by the
student, and to print it with his/her roll number
and name.
 2. Fifty students of a class appear in the
examination of below example1 .Draw a flowchart
for the algorithm to calculate and print the
percentage marks obtained by each student
along with his/her roll number and name.
 For the examination of below example1, we want
to make a list of only those students who passed
the examination (obtained 30% or more marks).
In the end, we also want to print the total number
of students who passed. A trailer record having
sentinel value of 9999999 for Rollno terminates
input data of all students. Draw a flowchart for an
algorithm to process this requirement.
 Input data of each student for the examination of
example1 also contains information regarding
his/her sex in a field named Sexcode having
value M (for male) or F(for female). We want to
make a list of only those female students who
passed in second division(obtained 45% or more
but less than 60% marks.) In the end, we also
want to print the total number of such students. A
trailer record having a sentinel value of Z for
Sexcode terminates input data of all students.
Draw a flowchart for an algorithm to process this
requirement.
Levels of Flowcharts
 There are no set standards on the amount of
detail required in flowchart.A flowchart that
outlines the main segments of a program (shows
only broad details) is a macro flowchart, and a
flowchart with more details is a micro
flowchart(also called detailed flowchart).

Flowcharting Rules
 The basic flowcharting rules and guidelines are as follows:
1. First chart the main line of logic, and then incorporate deatails.
2. Maintain a consistent level of details for a given flowchart.
3. Do not chart every detail in a flowchart; otherwise, the
flowchart will only be a graphic representation of all the steps
of the corresponding program. A reader interested in details
can refer to the program itself.
4. Use common statements that are easy to understand for words
within flowchart symbols. Use descriptive titles written in your
own language, rather than machine-oriented language.
5. Be consistent in using names and variables in a flowchart.
6. Go from left to right and top to bottom in constructing a
flowchart.
7. Keep a flowchart as simple as possible, and avoid crossing of
flow lines.
8. If you need a new page while drawing a flowchart, break the
flowchart at an input or output point. Moreover, use properly
labeled connectors to link portions of the flowchart on different
pages.
Advantage and Limitations of
Flowcharts
 Advantage
 Better communication
 Effective analysis
 Effective synthesis
 Proper program documentation
 Efficient coding
 Systematic debugging
 Systematic testings
Limitations
 Flowcharts are very time consuming and laborious to draw
with proper symbols and spacing, especially for large
complex programs. You can very well imagine how difficult
it would be to develop a detailed flowchart for a program
containing over 50000 statements.
 Any change and modification in program logic usually
requires a completely new flowchart. Redrawing a
flowchart being a tedious task
 Many companies use software tools that generate
flowcharts automatically from program code.
 This backward approach draws flowcharts from program
codes mainly for documentation purpose.
 There are no standards determining the amount of detail
that should be included in a flowchart.
 Because of such limitations, many organizations have
reduced the amount of flowcharting used. In its place they
use alternative tools for program analysis, two of which are
described below.
Bisection Method#include<stdio.h>
#define e 0.001
#define f(x) x*x*x -4*x +1
Void main()
{
float x0,x1,x2;
float f0,f1,f2;
clrscr();
printf(“Enter the values of x0 and x1”);
scanf(“%f%f”,&x0,&x1);
do{
f0 = f(x0);
f1 = f(x1);
x2=(x0+x1)/2;
f2=f(x2);
if(f0*f2<0)
{
x1=x2;
}
else
{
x0=x2;
}
i++;
printf(“No. of Iterations:=%d”,i);
printf(“Root:=%f”,x2);
printf(“Value of function =%fn”,f2);
}while(fabs(f2)<e);
getch();
}
Basic structure and functioning of
computers with a PC as as
illustrative example
Memory
Input Output Devices
Secondary Storage
Computer language
Operating system with DOS as an
example
 MS-DOS stands for Microsoft Disk Operating
System.
 It is a single-user operating system for IBM and
IBM compatible personal computers.
 Microsoft and IBM introduced it jointly in 1981.
 It was the most popular OS for personal
computers in the 1980’s .
 Because of its popularity,Microsoft later took a
decision to launch independently Microsoft
Windows operating system in 1990s.
Structure of MS-DOS
 MS-DOS has the following three layers:
1. BIOS 2. Kernel 3. Shell
 BIOS: stands for Basic Input Output System.
 It contains device drivers for standard devices such
as keyboard,disk,floppy, printer, and display monitor.
 It also contains basic low-level services such as time-
of-day and system configuration analysis.
 With hardware-dependent services in a BIOS, the
operating system ensures that it can offer other
higher-level operating system services in a hardware-
independent manner.
 This enables those operating system services to be
portable easily to other machines.
 Usually, computer manufecturers (not Microsoft)
supply the BIOS.
 Generally, the BIOS is located, in part, in a ROM,
which is a non-erasable memory.
BIOS
 When a user switches on a computer, the
computer’s hardware transfers control to the
bootstrap procedure of the BIOS in ROM.
 The bootstrap procedure carries out some
hardware tests to check whether the memory and
other hardware devices are functioning properly.
 If the hardware tests pass successfully, the
bootstrap procedure loads into memory a small
portion of the operating system from disk.
 This part of the operating system then loads the
rest of the mem
Introduction to UNIX and
WINDOWS
Data Processing
Principal of programming

More Related Content

What's hot

Programming process and flowchart
Programming process and flowchartProgramming process and flowchart
Programming process and flowcharthermiraguilar
 
Algorithms
AlgorithmsAlgorithms
Algorithms
Liam Dunphy
 
Lecture 4
Lecture 4Lecture 4
Lecture 4
Anshumali Singh
 
La5 Basicelement
La5 BasicelementLa5 Basicelement
La5 BasicelementCma Mohd
 
Problem Solving Techniques
Problem Solving TechniquesProblem Solving Techniques
Problem Solving TechniquesAshesh R
 
Problem solving (C++ Programming)
Problem solving (C++ Programming)Problem solving (C++ Programming)
Problem solving (C++ Programming)
Umair Younas
 
Coding
CodingCoding
Coding
Vishal Singh
 
Introduction to Programming
Introduction to ProgrammingIntroduction to Programming
Introduction to ProgrammingChaffey College
 
Unit 1. Problem Solving with Computer
Unit 1. Problem Solving with Computer   Unit 1. Problem Solving with Computer
Unit 1. Problem Solving with Computer
Ashim Lamichhane
 
Algorithm - Introduction
Algorithm - IntroductionAlgorithm - Introduction
Algorithm - Introduction
Madhu Bala
 
Logic Formulation 2
Logic Formulation 2Logic Formulation 2
Logic Formulation 2
deathful
 
The analysis synthesis model of compilation
The analysis synthesis model of compilationThe analysis synthesis model of compilation
The analysis synthesis model of compilationHuawei Technologies
 
Phases of the Compiler - Systems Programming
Phases of the Compiler - Systems ProgrammingPhases of the Compiler - Systems Programming
Phases of the Compiler - Systems Programming
Mukesh Tekwani
 
Unit1 principle of programming language
Unit1 principle of programming languageUnit1 principle of programming language
Unit1 principle of programming languageVasavi College of Engg
 
Programming Fundamentals
Programming FundamentalsProgramming Fundamentals
Programming Fundamentals
Trivuz ত্রিভুজ
 
Introduction to Computer and Programming - Lecture 03
Introduction to Computer and Programming - Lecture 03Introduction to Computer and Programming - Lecture 03
Introduction to Computer and Programming - Lecture 03hassaanciit
 
phases of compiler-analysis phase
phases of compiler-analysis phasephases of compiler-analysis phase
phases of compiler-analysis phase
Suyash Srivastava
 
Software tools
Software toolsSoftware tools
Software tools
ravindravekariya
 

What's hot (20)

Programming process and flowchart
Programming process and flowchartProgramming process and flowchart
Programming process and flowchart
 
Algorithms
AlgorithmsAlgorithms
Algorithms
 
The Programming Process
The Programming ProcessThe Programming Process
The Programming Process
 
Lecture 4
Lecture 4Lecture 4
Lecture 4
 
La5 Basicelement
La5 BasicelementLa5 Basicelement
La5 Basicelement
 
Problem Solving Techniques
Problem Solving TechniquesProblem Solving Techniques
Problem Solving Techniques
 
Problem solving (C++ Programming)
Problem solving (C++ Programming)Problem solving (C++ Programming)
Problem solving (C++ Programming)
 
Coding
CodingCoding
Coding
 
Introduction to Programming
Introduction to ProgrammingIntroduction to Programming
Introduction to Programming
 
Unit 1. Problem Solving with Computer
Unit 1. Problem Solving with Computer   Unit 1. Problem Solving with Computer
Unit 1. Problem Solving with Computer
 
Algorithm - Introduction
Algorithm - IntroductionAlgorithm - Introduction
Algorithm - Introduction
 
Logic Formulation 2
Logic Formulation 2Logic Formulation 2
Logic Formulation 2
 
The analysis synthesis model of compilation
The analysis synthesis model of compilationThe analysis synthesis model of compilation
The analysis synthesis model of compilation
 
Phases of the Compiler - Systems Programming
Phases of the Compiler - Systems ProgrammingPhases of the Compiler - Systems Programming
Phases of the Compiler - Systems Programming
 
Unit1 principle of programming language
Unit1 principle of programming languageUnit1 principle of programming language
Unit1 principle of programming language
 
Training 8051Report
Training 8051ReportTraining 8051Report
Training 8051Report
 
Programming Fundamentals
Programming FundamentalsProgramming Fundamentals
Programming Fundamentals
 
Introduction to Computer and Programming - Lecture 03
Introduction to Computer and Programming - Lecture 03Introduction to Computer and Programming - Lecture 03
Introduction to Computer and Programming - Lecture 03
 
phases of compiler-analysis phase
phases of compiler-analysis phasephases of compiler-analysis phase
phases of compiler-analysis phase
 
Software tools
Software toolsSoftware tools
Software tools
 

Similar to What is algorithm

Ch1 principles of software development
Ch1 principles of software developmentCh1 principles of software development
Ch1 principles of software developmentHattori Sidek
 
Software develop....
Software develop.... Software develop....
Software develop....
GCWUS
 
PCCF UNIT 1.pptx
PCCF UNIT 1.pptxPCCF UNIT 1.pptx
PCCF UNIT 1.pptx
DivyaKS12
 
Algorithm and Flowcharts
Algorithm and FlowchartsAlgorithm and Flowcharts
Algorithm and Flowcharts
SURBHI SAROHA
 
Introduction to Computer Programming
Introduction to Computer ProgrammingIntroduction to Computer Programming
Introduction to Computer ProgrammingProf. Erwin Globio
 
GE3151 PSPP _Unit 1 notes and Question bank.pdf
GE3151 PSPP _Unit 1 notes and Question bank.pdfGE3151 PSPP _Unit 1 notes and Question bank.pdf
GE3151 PSPP _Unit 1 notes and Question bank.pdf
Asst.prof M.Gokilavani
 
Programming_Lecture_1.pptx
Programming_Lecture_1.pptxProgramming_Lecture_1.pptx
Programming_Lecture_1.pptx
shoaibkhan716300
 
PDLC.pptx
PDLC.pptxPDLC.pptx
PDLC.pptx
marysj3
 
Problem-solving and design 1.pptx
Problem-solving and design 1.pptxProblem-solving and design 1.pptx
Problem-solving and design 1.pptx
TadiwaMawere
 
pccf unit 1 _VP.pptx
pccf unit 1 _VP.pptxpccf unit 1 _VP.pptx
pccf unit 1 _VP.pptx
vishnupriyapm4
 
Algorithm and flowchart2010
Algorithm and flowchart2010Algorithm and flowchart2010
Algorithm and flowchart2010
Jordan Delacruz
 
Introduction to computer science
Introduction to computer scienceIntroduction to computer science
Introduction to computer science
umardanjumamaiwada
 
lecture 5
 lecture 5 lecture 5
lecture 5
umardanjumamaiwada
 
Introduction to Programming.docx
Introduction to Programming.docxIntroduction to Programming.docx
Introduction to Programming.docx
JohnBrianCatedrilla1
 
UNIT 2 ECSE-2.pptx
UNIT 2 ECSE-2.pptxUNIT 2 ECSE-2.pptx
UNIT 2 ECSE-2.pptx
AdharshKokkula
 
Program logic and design
Program logic and designProgram logic and design
Program logic and designChaffey College
 
System programming and implementation
System programming and implementationSystem programming and implementation
System programming and implementationJohn Todora
 
Introduction.pptx
Introduction.pptxIntroduction.pptx
Introduction.pptx
ssusera8c91a
 
6272 cnote
6272 cnote6272 cnote
6272 cnote
P Kiran Sree
 
Program concep sequential statements
Program concep sequential statementsProgram concep sequential statements
Program concep sequential statements
ankurkhanna
 

Similar to What is algorithm (20)

Ch1 principles of software development
Ch1 principles of software developmentCh1 principles of software development
Ch1 principles of software development
 
Software develop....
Software develop.... Software develop....
Software develop....
 
PCCF UNIT 1.pptx
PCCF UNIT 1.pptxPCCF UNIT 1.pptx
PCCF UNIT 1.pptx
 
Algorithm and Flowcharts
Algorithm and FlowchartsAlgorithm and Flowcharts
Algorithm and Flowcharts
 
Introduction to Computer Programming
Introduction to Computer ProgrammingIntroduction to Computer Programming
Introduction to Computer Programming
 
GE3151 PSPP _Unit 1 notes and Question bank.pdf
GE3151 PSPP _Unit 1 notes and Question bank.pdfGE3151 PSPP _Unit 1 notes and Question bank.pdf
GE3151 PSPP _Unit 1 notes and Question bank.pdf
 
Programming_Lecture_1.pptx
Programming_Lecture_1.pptxProgramming_Lecture_1.pptx
Programming_Lecture_1.pptx
 
PDLC.pptx
PDLC.pptxPDLC.pptx
PDLC.pptx
 
Problem-solving and design 1.pptx
Problem-solving and design 1.pptxProblem-solving and design 1.pptx
Problem-solving and design 1.pptx
 
pccf unit 1 _VP.pptx
pccf unit 1 _VP.pptxpccf unit 1 _VP.pptx
pccf unit 1 _VP.pptx
 
Algorithm and flowchart2010
Algorithm and flowchart2010Algorithm and flowchart2010
Algorithm and flowchart2010
 
Introduction to computer science
Introduction to computer scienceIntroduction to computer science
Introduction to computer science
 
lecture 5
 lecture 5 lecture 5
lecture 5
 
Introduction to Programming.docx
Introduction to Programming.docxIntroduction to Programming.docx
Introduction to Programming.docx
 
UNIT 2 ECSE-2.pptx
UNIT 2 ECSE-2.pptxUNIT 2 ECSE-2.pptx
UNIT 2 ECSE-2.pptx
 
Program logic and design
Program logic and designProgram logic and design
Program logic and design
 
System programming and implementation
System programming and implementationSystem programming and implementation
System programming and implementation
 
Introduction.pptx
Introduction.pptxIntroduction.pptx
Introduction.pptx
 
6272 cnote
6272 cnote6272 cnote
6272 cnote
 
Program concep sequential statements
Program concep sequential statementsProgram concep sequential statements
Program concep sequential statements
 

More from mshoaib15

Msc prev completed
Msc prev completedMsc prev completed
Msc prev completed
mshoaib15
 
Msc prev updated
Msc prev updatedMsc prev updated
Msc prev updated
mshoaib15
 
Msc chemistry previous
Msc chemistry previousMsc chemistry previous
Msc chemistry previous
mshoaib15
 
Bsc math previous exam quetions
Bsc math previous exam quetionsBsc math previous exam quetions
Bsc math previous exam quetions
mshoaib15
 
Function
FunctionFunction
Function
mshoaib15
 
Computer lab (programs)
Computer lab (programs)Computer lab (programs)
Computer lab (programs)
mshoaib15
 
Boolean expression org.
Boolean expression org.Boolean expression org.
Boolean expression org.
mshoaib15
 
Number system....
Number system....Number system....
Number system....mshoaib15
 

More from mshoaib15 (8)

Msc prev completed
Msc prev completedMsc prev completed
Msc prev completed
 
Msc prev updated
Msc prev updatedMsc prev updated
Msc prev updated
 
Msc chemistry previous
Msc chemistry previousMsc chemistry previous
Msc chemistry previous
 
Bsc math previous exam quetions
Bsc math previous exam quetionsBsc math previous exam quetions
Bsc math previous exam quetions
 
Function
FunctionFunction
Function
 
Computer lab (programs)
Computer lab (programs)Computer lab (programs)
Computer lab (programs)
 
Boolean expression org.
Boolean expression org.Boolean expression org.
Boolean expression org.
 
Number system....
Number system....Number system....
Number system....
 

Recently uploaded

Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
Peter Spielvogel
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 

Recently uploaded (20)

Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 

What is algorithm

  • 2. Programmer’s model of a computer algorithms  In programming, algorithm is a set of well defined instructions in sequence to solve the problem.  The correct sequence of instructions needed to solve the corresponding problem.  The term algorithm refers to the logic of a program.  It is a step by step description of how to arrive at a solution to a given problem.
  • 3. Characteristics  Each instruction should be precise and unambiguous.  Each instruction should be executed in a finite time.  No instruction should repeat infinitely. This ensures that the algorithm terminates ultimately.  After executing the instructions (when the algorithm terminates), the desired results are obtained.
  • 4. Sample Algorithm  Problem1 :  Fifty students in a class appeared in their final examination. The division column of their mark sheets contains the division(FIRST, SECOND, THIRD or FAIL) obtained by them. If their mark sheets are available with you, write an algorithm to calculate and print the total number of students who in FIRST division.
  • 5. Algorithm Step  Step 1: Initalize Total_First_Division and Total_Marksheets_Checked to zero.  Step 2: Take the mark sheet of the next student.  Step 3: Check the division column of the mark sheet to see if it is FIRST. If no, go to Step 5.  Step 4: Add 1 to Total_First_Division.  Step 5: Add 1 to Total_Marksheets_Checked.  Step 6: Is Total_Marksheets_Checked=50?. If no,go to Step 2.  Step 7: Print Total_First_Division.  Step 8 : Stop
  • 6. Representation of Algorithm  Commonly used ways to represent an algorithm are :  As program  As flowchart  As pseudocode
  • 7. Flow Chart  A Flowchart is a pictorial representation of an algorithm.  Programmers often use it as a program-planning tool for visually organizing a sequence of steps necessary to solve a problem using a computer.  It uses boxes of different shapes to denote different types of instructions.  Programmers write actual instructions within these boxes using clear and concise statements.  Direct solid lines connecting these boxes indicate flow of operations – sequence in which to execute the instructions.  The process of drawing a flowchart for an algorithm is known as flowcharting.
  • 8. WHY USE FLOWCHARTS?  Normally two steps 1. Algo 2. flowchart for preparing program.  Advantage of two steps approach in program writing is that  Programmer can concentate fully on the logic of the solution to the problem at hand, without paying attention to the syntax and other details of the programming language.  Flow chart shows the flow of operations in pictorial form, a programmer can detect any error in the logic with greater ease than in the case of a program.  Once the flowchart is ready, the programmer can concentrate on coding the operations in each box of the flowchart as statements of the programming language.
  • 9. FLOWCHART SYMBOLS  A flowchart uses boxes of different shapes to denote different types of instructions.  The use of symbols having standardized meanings makes it easier to communicate program logic through flowcharts. Terminal Input/Output Processing Decision Flow lines Connectors
  • 10.  Terminal  Input/Output  Processing  Decision  Flow lines  Connectors
  • 11. Sample Flowchart  1. A student appears for an examination consisting of total 10 subjects with each subject having maximum marks of 100. The student’s roll number, name and marks obtained by him/her in various subjects are input data.Such a collection of related data items, treated as a unit, is known as a record. Draw a flowchart for the algorithm to calculate the percentage marks obtained by the student, and to print it with his/her roll number and name.
  • 12.  2. Fifty students of a class appear in the examination of below example1 .Draw a flowchart for the algorithm to calculate and print the percentage marks obtained by each student along with his/her roll number and name.
  • 13.  For the examination of below example1, we want to make a list of only those students who passed the examination (obtained 30% or more marks). In the end, we also want to print the total number of students who passed. A trailer record having sentinel value of 9999999 for Rollno terminates input data of all students. Draw a flowchart for an algorithm to process this requirement.
  • 14.  Input data of each student for the examination of example1 also contains information regarding his/her sex in a field named Sexcode having value M (for male) or F(for female). We want to make a list of only those female students who passed in second division(obtained 45% or more but less than 60% marks.) In the end, we also want to print the total number of such students. A trailer record having a sentinel value of Z for Sexcode terminates input data of all students. Draw a flowchart for an algorithm to process this requirement.
  • 15. Levels of Flowcharts  There are no set standards on the amount of detail required in flowchart.A flowchart that outlines the main segments of a program (shows only broad details) is a macro flowchart, and a flowchart with more details is a micro flowchart(also called detailed flowchart). 
  • 16. Flowcharting Rules  The basic flowcharting rules and guidelines are as follows: 1. First chart the main line of logic, and then incorporate deatails. 2. Maintain a consistent level of details for a given flowchart. 3. Do not chart every detail in a flowchart; otherwise, the flowchart will only be a graphic representation of all the steps of the corresponding program. A reader interested in details can refer to the program itself. 4. Use common statements that are easy to understand for words within flowchart symbols. Use descriptive titles written in your own language, rather than machine-oriented language. 5. Be consistent in using names and variables in a flowchart. 6. Go from left to right and top to bottom in constructing a flowchart. 7. Keep a flowchart as simple as possible, and avoid crossing of flow lines. 8. If you need a new page while drawing a flowchart, break the flowchart at an input or output point. Moreover, use properly labeled connectors to link portions of the flowchart on different pages.
  • 17. Advantage and Limitations of Flowcharts  Advantage  Better communication  Effective analysis  Effective synthesis  Proper program documentation  Efficient coding  Systematic debugging  Systematic testings
  • 18. Limitations  Flowcharts are very time consuming and laborious to draw with proper symbols and spacing, especially for large complex programs. You can very well imagine how difficult it would be to develop a detailed flowchart for a program containing over 50000 statements.  Any change and modification in program logic usually requires a completely new flowchart. Redrawing a flowchart being a tedious task  Many companies use software tools that generate flowcharts automatically from program code.  This backward approach draws flowcharts from program codes mainly for documentation purpose.  There are no standards determining the amount of detail that should be included in a flowchart.  Because of such limitations, many organizations have reduced the amount of flowcharting used. In its place they use alternative tools for program analysis, two of which are described below.
  • 19. Bisection Method#include<stdio.h> #define e 0.001 #define f(x) x*x*x -4*x +1 Void main() { float x0,x1,x2; float f0,f1,f2; clrscr(); printf(“Enter the values of x0 and x1”); scanf(“%f%f”,&x0,&x1); do{ f0 = f(x0); f1 = f(x1); x2=(x0+x1)/2; f2=f(x2); if(f0*f2<0) { x1=x2; } else { x0=x2; } i++; printf(“No. of Iterations:=%d”,i); printf(“Root:=%f”,x2); printf(“Value of function =%fn”,f2); }while(fabs(f2)<e); getch(); }
  • 20. Basic structure and functioning of computers with a PC as as illustrative example
  • 25. Operating system with DOS as an example  MS-DOS stands for Microsoft Disk Operating System.  It is a single-user operating system for IBM and IBM compatible personal computers.  Microsoft and IBM introduced it jointly in 1981.  It was the most popular OS for personal computers in the 1980’s .  Because of its popularity,Microsoft later took a decision to launch independently Microsoft Windows operating system in 1990s.
  • 26. Structure of MS-DOS  MS-DOS has the following three layers: 1. BIOS 2. Kernel 3. Shell  BIOS: stands for Basic Input Output System.  It contains device drivers for standard devices such as keyboard,disk,floppy, printer, and display monitor.  It also contains basic low-level services such as time- of-day and system configuration analysis.  With hardware-dependent services in a BIOS, the operating system ensures that it can offer other higher-level operating system services in a hardware- independent manner.  This enables those operating system services to be portable easily to other machines.  Usually, computer manufecturers (not Microsoft) supply the BIOS.  Generally, the BIOS is located, in part, in a ROM, which is a non-erasable memory.
  • 27. BIOS  When a user switches on a computer, the computer’s hardware transfers control to the bootstrap procedure of the BIOS in ROM.  The bootstrap procedure carries out some hardware tests to check whether the memory and other hardware devices are functioning properly.  If the hardware tests pass successfully, the bootstrap procedure loads into memory a small portion of the operating system from disk.  This part of the operating system then loads the rest of the mem
  • 28. Introduction to UNIX and WINDOWS