SlideShare a Scribd company logo
UNIT-I ALGORITHMIC PROBLEM
SOLVING
• By
K.Karthick, AP/CSE
Kongunadu College Of Engineering And
Technology, Trichy
Algorithm -Introduction
Introduction:
After the preparation of suitable plan for
developing the program by it’s logic, The
correct sequence and procedure of
instructions required to complete the task.
The algorithms is also used to refer the
logic of a program.
Definition:
Algorithm is defined as a step by step
procedure for solving any problem.
It is also a precise rule to specifying how to
solve a problem,
An algorithm is a sequence of finite
instructions used for calculation and data
processing.
Example:
STEP-1: Start
STEP-2: Read the value of radius r
STEP-3: Calculate Area=3.14*r*r
STEP-4: Print the area of circle
STEP-5: Stop
Characteristics of Algorithm
• An Algorithm contains step by step effective
information, It is not a computer program ,It is
one of the basic tool in problem solving.
Characteristics:
Algorithm has a finite number of inputs.
Every instruction should be precise and
unambiguous.
It looks like a normal English.
Effectiveness of each step is very important.
The desired output must obtained only after the
algorithm terminates.
The algorithm should written in sequence.
Qualities of an Algorithm
Different algorithm may perform the same task
with different set of instruction. Some algorithm is
better than the other in solving problem.
The following factors that determine the Quality of
algorithm are :
1.Time
2. Memory
3. Accuracy
4. Sequence
5. Generability
Building blocks of Algorithm
• Instruction/Statements
• State
• Control flow
• functions
Statements:
• Reserved words-words with predefined meaning
• Identifier- words created by programmer
• Literals- int, float, character, string
• Operators- unary, binary, ternary
State:
• Each step in an algorithm is a state.
• Start state, Input state, terminate in a defined
end-state, etc
Control flow:
• Control flow is the flow of control.
• It is used to determine what selection of code
is run in a program. It is the order in which the
program or statements are executed.
• It contains
(i) sequential
(iii) selective(decision making)
(iv) Iteration(loops)
1. Sequence Structure:
• the sequential control structure is used to
perform the actions one after another.
Eg:
Step 1: start
Step 2:Input first number as A
Step 3: Input second number as B
Step 4: set sum= A+B
Step 5: Print sum
Step 6:Stop
2. Selection Structure:
• Selection control structures (or) Decision
structures allows the program to make a
choice between two alternate paths whether
it is true or false.
Eg: Step 1: start
Step 2:Input first number as A
Step 3: Input second number as B
Step 4: IF A=B
print “equal”
ELSE
print ”Not equal”
[End of IF]
step 5: stop
IF THEN STRUCTURE
IF THEN ELSE STRUCTURE
CASE STRUCTURE
3. Iteration(Loops):
Iterative structures are used when part of
the program is to be executed several times.
Eg:
Step 1: [initialize]set I=1,N=10
Step 2:Repeat steps 3 & 4 while I<=N
Step 3: Print I
Step 4: set I=I+1
[End of the loop]
Step 5: end
Functions:
• Functions are “self contained” modules of
code that accomplish specific task.
• Functions usually “take in” data, process it
and “return “ result.
• Once a function is written, it can be used over
and over again.
• Functions can be “called” from the inside of
other functions.
Notation
1. Pseudocode
2. Flow chart
3. Programming language
Pseudocode:
pseudo means imitation
code means instruction
• Pseudo codes cannot be run, and there is no real
formatting or rules.
• Pseudo codes are an outline of a program that can
easily be converted into programming statements.
• Pseudo codes are not really codes, it is a mix of
choice of programming languages and your
preferred human languages.
Eg: sum of two numbers
READ the value of variables a and B
sum= A+B
WRITE the output of sum
Basic guidelines for writing pseudocode
1.Write only one statement per line
2. Capitalize initial keyword(keywords should be
capital letters)
Eg: READ,WRITE,IF,ELSE,ENDIF,WHILE,ENDWHILE,
REPEAT,UNTIL
3. Indent to show hierarchy
4. End multiline structures
ended properly which provides
clarity ex: ENDIF , END
• 5. Keep statements language independent
• user can write in whatever language they are most
comfortable .
• Advantages
– Can be easily done on a word processor
– Easily modified
– It is simple like English statements
– No special symbols used
Eg: pseudocode to find leap year
READ the value of year
IF (year%4==0)THEN
WRITE the year is a leap year
ELSE
WRITE the year is not a leap year
ENDIF
stop
Flowchart
• Flowchart is a pictorial representation of an
algorithm.
• A flowchart uses different shaped symbols for
representing different instruction and this
information written into small boxes using
clear statement.
• Here lines and arrow mark represent flow of
operation.
Aim of flowchart
• Program preparation is simplified
• Easier to understand
• Provide effective documentation
• Easy to analyze and compare with various
method
• Reviewing and debugging is easy
Flowchart Basic symbols
• Flow lines
• Start and Terminal symbols
• Input/output symbols
• Process symbols
• Decision symbols
• Connectors
RULES FOR DRAWING A FLOWCHART
• The standard symbols only used.
• Arrowhead represent direction of flow control
• Usual procedure of direction is top to bottom
• Only one flow line should come process
symbols and one flow line out from each
symbols.
• <0 >0
=0
Algorithm to perform addition
Step-1: Start the program
Step-2: Read the input values a,b
Step-3:Perform addition using the formula
c=a+b;
Step-4:write the result c
Step-5:stop the program.
Basic design structures in flowchart
Three basic structure available There are:
1 . Sequence structure:
It is simplest method , Here flow is goes to only
one direction that is top to bottom.
start
C=a+b
Read a b
Write c
stop
2.Selection structure
•
• false TrueIs
a>b
Write a is
Big
Write b
is big
stop
Read a,b
start
3. Loop structure
Top tested loop
No
Yes
start
Add 1 to count
Read
count =0
Write
count
If
count<5
Stop
Bottom tested loop
start
Add 1 to count
Read
count =0
Write
count
If
count<5
Stop
Advantages of Flowcharts
1. To understand the logic clearly
2. Better communication
3. Effective analysis (problem can be solved)
4. Effective synthesis
5. Effective coding
6. Proper program documentation
7. Systematic Debugging
8. Systematic testing
9. Efficient Program Maintenance.
Programming Language
Types:
(i)Machine language (eg: 01001101)
(ii)Assembly language (eg:mnemonics)
start
add x,y
sub x,y
(iii)High level language
Main()
{
if(x>y)
{
max=x;
}
else
{
max=y;
}
……………
}

More Related Content

PDF
Algorithmic problem sloving
Mani Kandan
 
PPT
Unit 1 python (2021 r)
praveena p
 
PDF
Introduction to Problem Solving Techniques- Python
PriyankaC44
 
PPTX
Unit 1. Problem Solving with Computer
Ashim Lamichhane
 
PPTX
Computer programming and utilization
Digvijaysinh Gohil
 
PPTX
Algorithms
Liam Dunphy
 
PDF
Unit 1-problem solving with algorithm
rajkumar1631010038
 
PDF
Algorithm and Programming (Introduction of Algorithms)
Adam Mukharil Bachtiar
 
Algorithmic problem sloving
Mani Kandan
 
Unit 1 python (2021 r)
praveena p
 
Introduction to Problem Solving Techniques- Python
PriyankaC44
 
Unit 1. Problem Solving with Computer
Ashim Lamichhane
 
Computer programming and utilization
Digvijaysinh Gohil
 
Algorithms
Liam Dunphy
 
Unit 1-problem solving with algorithm
rajkumar1631010038
 
Algorithm and Programming (Introduction of Algorithms)
Adam Mukharil Bachtiar
 

What's hot (20)

PPT
algorithm
kokilabe
 
PPTX
Programming the basic computer
Kamal Acharya
 
PPTX
Raptor tool
AbiramiTabiit
 
PDF
Problem Solving Techniques and Introduction to C
Prabu U
 
PPTX
Valuable Information on Lexical Analysis in Compiler Design
Lesa Cote
 
PPTX
Programming process and flowchart
hermiraguilar
 
PPT
Lecture 4
Anshumali Singh
 
PPT
Cmp104 lec 7 algorithm and flowcharts
kapil078
 
PPT
Program Logic Formulation - Ohio State University
Reggie Niccolo Santos
 
PPTX
FPL -Part 2 ( Sem - I 2013)
Yogesh Deshpande
 
PPTX
Programming flowcharts for C Language
Aryan Ajmer
 
PPT
Chapter 02 - Problem Solving
Luis Daniel Serrano
 
PPTX
Algorithm and Flowcharts
Dr. SURBHI SAROHA
 
PPTX
Cs1123 2 comp_prog
TAlha MAlik
 
PPTX
The analysis synthesis model of compilation
Huawei Technologies
 
PPTX
STRUCTURED PROGRAMMING Chap2
Bro Shola Ajayi
 
PDF
Algorithm and c language
kamalbeydoun
 
PDF
Lesson 2 beginning the problem solving process
MLG College of Learning, Inc
 
PPTX
Algorithm &amp; flowchart
saurabh sen sky
 
PDF
Problem solving (C++ Programming)
Umair Younas
 
algorithm
kokilabe
 
Programming the basic computer
Kamal Acharya
 
Raptor tool
AbiramiTabiit
 
Problem Solving Techniques and Introduction to C
Prabu U
 
Valuable Information on Lexical Analysis in Compiler Design
Lesa Cote
 
Programming process and flowchart
hermiraguilar
 
Lecture 4
Anshumali Singh
 
Cmp104 lec 7 algorithm and flowcharts
kapil078
 
Program Logic Formulation - Ohio State University
Reggie Niccolo Santos
 
FPL -Part 2 ( Sem - I 2013)
Yogesh Deshpande
 
Programming flowcharts for C Language
Aryan Ajmer
 
Chapter 02 - Problem Solving
Luis Daniel Serrano
 
Algorithm and Flowcharts
Dr. SURBHI SAROHA
 
Cs1123 2 comp_prog
TAlha MAlik
 
The analysis synthesis model of compilation
Huawei Technologies
 
STRUCTURED PROGRAMMING Chap2
Bro Shola Ajayi
 
Algorithm and c language
kamalbeydoun
 
Lesson 2 beginning the problem solving process
MLG College of Learning, Inc
 
Algorithm &amp; flowchart
saurabh sen sky
 
Problem solving (C++ Programming)
Umair Younas
 
Ad

Similar to Unit 1 psp (20)

PDF
final Unit 1-1.pdf
prakashvs7
 
PPTX
Basic syntax : Algorithm,Flow chart
Prasanna R Kovath
 
PPTX
Pseudo code.pptx
Chaya64047
 
PDF
PROGRAMMING IN C UNIT I.pdffffffffffffffffffffffffd
dinesh620610
 
PPT
C programming for Computing Techniques
Appili Vamsi Krishna
 
PDF
CP c++ programing project Unit 1 intro.pdf
ShivamYadav886008
 
PPTX
MODULE1-INTRODUCTION.pptx-COMPUTER PROGRAMING
MarcMiguel2
 
PPTX
s-INTRODUCTION TO PROBLEM SOLVING PPT.pptx
ShamithRai
 
PPTX
Data Structures_Introduction to algorithms.pptx
RushaliDeshmukh2
 
PDF
Algorithm & Flowchart.pdf
Vpmv
 
PDF
Fundamental of Information Technology - UNIT 6
Shipra Swati
 
PPT
BCE L-2 Algorithms-and-Flowchart-ppt.ppt
Kirti Verma
 
PPTX
UNIT I.pptxpython unit 1 engineering full unit completed
pavithrad67
 
PPT
Programming Fundamentals - Lecture 1.ppt
FarhanGhafoor7
 
PDF
Algorithm.pdf
MIT,Imphal
 
PPTX
Introduction to computer programming
Sangheethaa Sukumaran
 
PPTX
PROBLEM SOLVING.pptx
sumathysenthilkumar
 
PPTX
basics of c programming for naiver.pptx
ssuser96ba7e1
 
PPT
Problem Solving Techniques notes for Unit 1
SATHYABAMAMADHANKUMA
 
PPTX
02 Algorithms and flowcharts - computers.pptx
arifaqazi2
 
final Unit 1-1.pdf
prakashvs7
 
Basic syntax : Algorithm,Flow chart
Prasanna R Kovath
 
Pseudo code.pptx
Chaya64047
 
PROGRAMMING IN C UNIT I.pdffffffffffffffffffffffffd
dinesh620610
 
C programming for Computing Techniques
Appili Vamsi Krishna
 
CP c++ programing project Unit 1 intro.pdf
ShivamYadav886008
 
MODULE1-INTRODUCTION.pptx-COMPUTER PROGRAMING
MarcMiguel2
 
s-INTRODUCTION TO PROBLEM SOLVING PPT.pptx
ShamithRai
 
Data Structures_Introduction to algorithms.pptx
RushaliDeshmukh2
 
Algorithm & Flowchart.pdf
Vpmv
 
Fundamental of Information Technology - UNIT 6
Shipra Swati
 
BCE L-2 Algorithms-and-Flowchart-ppt.ppt
Kirti Verma
 
UNIT I.pptxpython unit 1 engineering full unit completed
pavithrad67
 
Programming Fundamentals - Lecture 1.ppt
FarhanGhafoor7
 
Algorithm.pdf
MIT,Imphal
 
Introduction to computer programming
Sangheethaa Sukumaran
 
PROBLEM SOLVING.pptx
sumathysenthilkumar
 
basics of c programming for naiver.pptx
ssuser96ba7e1
 
Problem Solving Techniques notes for Unit 1
SATHYABAMAMADHANKUMA
 
02 Algorithms and flowcharts - computers.pptx
arifaqazi2
 
Ad

Recently uploaded (20)

PDF
settlement FOR FOUNDATION ENGINEERS.pdf
Endalkazene
 
PDF
Biodegradable Plastics: Innovations and Market Potential (www.kiu.ac.ug)
publication11
 
PDF
Construction of a Thermal Vacuum Chamber for Environment Test of Triple CubeS...
2208441
 
PPTX
MT Chapter 1.pptx- Magnetic particle testing
ABCAnyBodyCanRelax
 
PPTX
business incubation centre aaaaaaaaaaaaaa
hodeeesite4
 
PDF
Advanced LangChain & RAG: Building a Financial AI Assistant with Real-Time Data
Soufiane Sejjari
 
PDF
STUDY OF NOVEL CHANNEL MATERIALS USING III-V COMPOUNDS WITH VARIOUS GATE DIEL...
ijoejnl
 
PPTX
22PCOAM21 Session 1 Data Management.pptx
Guru Nanak Technical Institutions
 
PDF
Introduction to Ship Engine Room Systems.pdf
Mahmoud Moghtaderi
 
PDF
Zero Carbon Building Performance standard
BassemOsman1
 
PDF
AI-Driven IoT-Enabled UAV Inspection Framework for Predictive Maintenance and...
ijcncjournal019
 
PDF
Cryptography and Information :Security Fundamentals
Dr. Madhuri Jawale
 
PDF
CAD-CAM U-1 Combined Notes_57761226_2025_04_22_14_40.pdf
shailendrapratap2002
 
PDF
The Effect of Artifact Removal from EEG Signals on the Detection of Epileptic...
Partho Prosad
 
PPTX
MULTI LEVEL DATA TRACKING USING COOJA.pptx
dollysharma12ab
 
PPTX
Tunnel Ventilation System in Kanpur Metro
220105053
 
PDF
Unit I Part II.pdf : Security Fundamentals
Dr. Madhuri Jawale
 
PDF
Chad Ayach - A Versatile Aerospace Professional
Chad Ayach
 
PDF
2025 Laurence Sigler - Advancing Decision Support. Content Management Ecommer...
Francisco Javier Mora Serrano
 
PPTX
Information Retrieval and Extraction - Module 7
premSankar19
 
settlement FOR FOUNDATION ENGINEERS.pdf
Endalkazene
 
Biodegradable Plastics: Innovations and Market Potential (www.kiu.ac.ug)
publication11
 
Construction of a Thermal Vacuum Chamber for Environment Test of Triple CubeS...
2208441
 
MT Chapter 1.pptx- Magnetic particle testing
ABCAnyBodyCanRelax
 
business incubation centre aaaaaaaaaaaaaa
hodeeesite4
 
Advanced LangChain & RAG: Building a Financial AI Assistant with Real-Time Data
Soufiane Sejjari
 
STUDY OF NOVEL CHANNEL MATERIALS USING III-V COMPOUNDS WITH VARIOUS GATE DIEL...
ijoejnl
 
22PCOAM21 Session 1 Data Management.pptx
Guru Nanak Technical Institutions
 
Introduction to Ship Engine Room Systems.pdf
Mahmoud Moghtaderi
 
Zero Carbon Building Performance standard
BassemOsman1
 
AI-Driven IoT-Enabled UAV Inspection Framework for Predictive Maintenance and...
ijcncjournal019
 
Cryptography and Information :Security Fundamentals
Dr. Madhuri Jawale
 
CAD-CAM U-1 Combined Notes_57761226_2025_04_22_14_40.pdf
shailendrapratap2002
 
The Effect of Artifact Removal from EEG Signals on the Detection of Epileptic...
Partho Prosad
 
MULTI LEVEL DATA TRACKING USING COOJA.pptx
dollysharma12ab
 
Tunnel Ventilation System in Kanpur Metro
220105053
 
Unit I Part II.pdf : Security Fundamentals
Dr. Madhuri Jawale
 
Chad Ayach - A Versatile Aerospace Professional
Chad Ayach
 
2025 Laurence Sigler - Advancing Decision Support. Content Management Ecommer...
Francisco Javier Mora Serrano
 
Information Retrieval and Extraction - Module 7
premSankar19
 

Unit 1 psp

  • 1. UNIT-I ALGORITHMIC PROBLEM SOLVING • By K.Karthick, AP/CSE Kongunadu College Of Engineering And Technology, Trichy
  • 2. Algorithm -Introduction Introduction: After the preparation of suitable plan for developing the program by it’s logic, The correct sequence and procedure of instructions required to complete the task. The algorithms is also used to refer the logic of a program.
  • 3. Definition: Algorithm is defined as a step by step procedure for solving any problem. It is also a precise rule to specifying how to solve a problem, An algorithm is a sequence of finite instructions used for calculation and data processing. Example: STEP-1: Start STEP-2: Read the value of radius r STEP-3: Calculate Area=3.14*r*r STEP-4: Print the area of circle STEP-5: Stop
  • 4. Characteristics of Algorithm • An Algorithm contains step by step effective information, It is not a computer program ,It is one of the basic tool in problem solving. Characteristics: Algorithm has a finite number of inputs. Every instruction should be precise and unambiguous. It looks like a normal English. Effectiveness of each step is very important. The desired output must obtained only after the algorithm terminates. The algorithm should written in sequence.
  • 5. Qualities of an Algorithm Different algorithm may perform the same task with different set of instruction. Some algorithm is better than the other in solving problem. The following factors that determine the Quality of algorithm are : 1.Time 2. Memory 3. Accuracy 4. Sequence 5. Generability
  • 6. Building blocks of Algorithm • Instruction/Statements • State • Control flow • functions
  • 7. Statements: • Reserved words-words with predefined meaning • Identifier- words created by programmer • Literals- int, float, character, string • Operators- unary, binary, ternary State: • Each step in an algorithm is a state. • Start state, Input state, terminate in a defined end-state, etc
  • 8. Control flow: • Control flow is the flow of control. • It is used to determine what selection of code is run in a program. It is the order in which the program or statements are executed. • It contains (i) sequential (iii) selective(decision making) (iv) Iteration(loops)
  • 9. 1. Sequence Structure: • the sequential control structure is used to perform the actions one after another. Eg: Step 1: start Step 2:Input first number as A Step 3: Input second number as B Step 4: set sum= A+B Step 5: Print sum Step 6:Stop
  • 10. 2. Selection Structure: • Selection control structures (or) Decision structures allows the program to make a choice between two alternate paths whether it is true or false. Eg: Step 1: start Step 2:Input first number as A Step 3: Input second number as B Step 4: IF A=B print “equal” ELSE print ”Not equal” [End of IF] step 5: stop
  • 12. IF THEN ELSE STRUCTURE
  • 14. 3. Iteration(Loops): Iterative structures are used when part of the program is to be executed several times. Eg: Step 1: [initialize]set I=1,N=10 Step 2:Repeat steps 3 & 4 while I<=N Step 3: Print I Step 4: set I=I+1 [End of the loop] Step 5: end
  • 15. Functions: • Functions are “self contained” modules of code that accomplish specific task. • Functions usually “take in” data, process it and “return “ result. • Once a function is written, it can be used over and over again. • Functions can be “called” from the inside of other functions.
  • 16. Notation 1. Pseudocode 2. Flow chart 3. Programming language
  • 17. Pseudocode: pseudo means imitation code means instruction • Pseudo codes cannot be run, and there is no real formatting or rules. • Pseudo codes are an outline of a program that can easily be converted into programming statements. • Pseudo codes are not really codes, it is a mix of choice of programming languages and your preferred human languages.
  • 18. Eg: sum of two numbers READ the value of variables a and B sum= A+B WRITE the output of sum
  • 19. Basic guidelines for writing pseudocode 1.Write only one statement per line 2. Capitalize initial keyword(keywords should be capital letters) Eg: READ,WRITE,IF,ELSE,ENDIF,WHILE,ENDWHILE, REPEAT,UNTIL 3. Indent to show hierarchy 4. End multiline structures ended properly which provides clarity ex: ENDIF , END
  • 20. • 5. Keep statements language independent • user can write in whatever language they are most comfortable . • Advantages – Can be easily done on a word processor – Easily modified – It is simple like English statements – No special symbols used
  • 21. Eg: pseudocode to find leap year READ the value of year IF (year%4==0)THEN WRITE the year is a leap year ELSE WRITE the year is not a leap year ENDIF stop
  • 22. Flowchart • Flowchart is a pictorial representation of an algorithm. • A flowchart uses different shaped symbols for representing different instruction and this information written into small boxes using clear statement. • Here lines and arrow mark represent flow of operation.
  • 23. Aim of flowchart • Program preparation is simplified • Easier to understand • Provide effective documentation • Easy to analyze and compare with various method • Reviewing and debugging is easy
  • 24. Flowchart Basic symbols • Flow lines • Start and Terminal symbols • Input/output symbols • Process symbols • Decision symbols • Connectors
  • 25. RULES FOR DRAWING A FLOWCHART • The standard symbols only used. • Arrowhead represent direction of flow control • Usual procedure of direction is top to bottom • Only one flow line should come process symbols and one flow line out from each symbols. • <0 >0 =0
  • 26. Algorithm to perform addition Step-1: Start the program Step-2: Read the input values a,b Step-3:Perform addition using the formula c=a+b; Step-4:write the result c Step-5:stop the program.
  • 27. Basic design structures in flowchart Three basic structure available There are: 1 . Sequence structure: It is simplest method , Here flow is goes to only one direction that is top to bottom. start C=a+b Read a b Write c stop
  • 28. 2.Selection structure • • false TrueIs a>b Write a is Big Write b is big stop Read a,b start
  • 29. 3. Loop structure Top tested loop No Yes start Add 1 to count Read count =0 Write count If count<5 Stop
  • 30. Bottom tested loop start Add 1 to count Read count =0 Write count If count<5 Stop
  • 31. Advantages of Flowcharts 1. To understand the logic clearly 2. Better communication 3. Effective analysis (problem can be solved) 4. Effective synthesis 5. Effective coding 6. Proper program documentation 7. Systematic Debugging 8. Systematic testing 9. Efficient Program Maintenance.
  • 32. Programming Language Types: (i)Machine language (eg: 01001101) (ii)Assembly language (eg:mnemonics) start add x,y sub x,y