SlideShare a Scribd company logo
UNIT - 1
Introduction: The Role of Algorithms in Computing, Algorithms
as a technology, Analyzing algorithms, Designing algorithms,
Growth of Functions, Asymptotic notation, Standard notations
and common functions.
Fundamental Algorithms: Exchanging the values of two
variables, Counting, Summation of a set of numbers, Factorial
Computation, Generating of the Fibonacci sequence, Reversing
the digits of an integer, Character to number conversion.
Problem solving
•It is a systematic approach to find and implement the solution to a
problem.
Program
•It is a set of instructions written in computer languages
Software
•It is a collection of computer program (or) data and instructions.
•It is responsible for controlling, integration and managing hardware
components and perform specific tasks.
Classifications of software
System software
•It is a set of one or more programs that manage and support
a computer system hardware and its data processing
activities.
•Ex: Operating system, Compilers, Assemblers
Application software
•It is a set of one or more programs, designed to solve a
specific problem or a specific task.
•Ex: Ms-Word ,Ms-Excel, Ms-Powerpoint
Steps in Problem Solving
1. Problem Definition
2. Problem Analysis
3. Design
4. Coding
5. Testing
6. Maintenance
1. Problem Definition
•To solve a problem, the first step is to
identify and define the problem.
•The problem must be stated clearly,
accurately and precisely.
•Ex: Find largest of three numbers
2. Problem Analysis
The problem analysis helps in designing and coding for that
particular problem.
1. Input specifications
•The number of inputs and what forms the input are available
2.Output specifications
•The number of outputs and what forms the output should be
displayed.
Ex:
•input – a,b,c
•output – a (or) b (or) c
3. Designing a program
Algorithms
•Algorithm - step by step procedure of solving a problem
Flowcharts
•Flowcharts – It is the graphical representation of the
algorithm.
4. Coding
• Writing instructions in a particular language to solve a
problem.
5. Testing a Program
• After writing a program, programmer needs to test the
program for completeness, correctness, reliability and
maintainability.
• Unit testing
• Program Testing
• Verification Testing
• Validation Testing
6. Maintaining the program
•It means periodic review of the
programs and modifications based on
user requirements.
What is an Algorithm?
•In computer programming terms, an algorithm is a set of
well-defined instructions to solve a particular problem. It
takes a set of input(s) and produces the desired output.
For example,
•An algorithm to add two numbers:
1. Take two number inputs
2. Add numbers using the + operator
3. Store the result
4. Display the result
Hint:
Need of the Algorithm:
Algorithms are used to solve problems or automate tasks in a systematic and efficient manner. They are a set of
instructions or rules that guide the computer or software in performing a particular task or solving a problem.
Qualities of a Good Algorithm
•Input and output should be defined
precisely.
•Each step in the algorithm should be clear
and unambiguous.
•Algorithms should be most effective among
many different ways to solve a problem.
•An algorithm shouldn't include computer
code. Instead, the algorithm should be
written in such a way that it can be used in
different programming languages.
Characteristics of an algorithm
The characteristics of an algorithm are
•(i) Algorithm must have finite number of steps.
•(ii) No instructions should be repeated.
•(iii) An algorithm should be simple.
•(iii) An algorithm must take atleast one or more
input values.
•(iv) An algorithm must provide atleast one or more
output values.
Characteristics of an algorithm
Advantages
•Algorithms are very easy to
understand.
•Algorithm is programming language
independent.
•Algorithm makes the problem simple,
clear, correct.
The Role of Algorithms
• Algorithms play a crucial role in computing by providing
a set of instructions for a computer to perform a specific
task.
• They are used to solve problems and carry out tasks in
computer systems, such as sorting data, searching for
information, image processing, and much more.
• An algorithm defines the steps necessary to produce
the desired outcome, and the computer follows the
instructions to complete the task efficiently and
accurately.
Role of Algorithm in Applications
Role of Algorithm in Computing
Role of Algorithm in Networking
Algorithm to Add two numbers entered by
the user
• Step 1: Start
• Step 2: Declare variables num1, num2 and sum.
• Step 3: Read values num1 and num2.
• Step 4: Add num1 and num2 and assign the result to sum.
• sum←num1+num2
• Step 5: Display sum
• Step 6: Stop
Algorithm for Swapping
two numbers using third
variable:
Step 1: Declare a variable a,b
and c as integer;
Step 2: Read two numbers a and
b;
Step 3: c=a;
Step 4: a=b;
Step 5: b=c;
Step 6: Print a and b
STEP 1: START
STEP 2: ENTER A, B
STEP 3: PRINT A, B
STEP 4: A = A + B
STEP 5: B= A - B
STEP 6: A =A - B
STEP 7: PRINT A, B
STEP 8: END
Algorithm for Swapping two
numbers without using third
variable:
Algorithm to find Summation of a set of
numbers
Step 1: Start
Step 2: Read the number n
Step 3: Calculate the sum of n natural number, sum = n * (n + 1) / 2
Step 4: Display sum
Step 5: End
Algorithm to find count of numbers of digits
in a number
• Step 1: Declare variable a and n; //n variable is used for counting
• Step 2: Read number a;
• Step 3: while(a not equal 0)
• a=a/10;
• n=n+1;
• end
• Step 4: Print n;
• Step 5: End
Algorithm to Find the largest number among
three numbers
Step 1: Start
Step 2: Declare variables a,b and c.
Step 3: Read variables a,b and c.
Step 4: If a > b
If a > c
Display a is the largest number.
Else
Display c is the largest number.
Else
If b > c
Display b is the largest number.
Else
Display c is the greatest number.
Step 5: Stop
Algorithm to Find the factorial of a number
Step 1: Start
Step 2: Declare variables n, fact and i.
Step 3: Initialize variables
fact← 1
i ← 1
Step 4: Read value of n
Step 5: Repeat the steps until i = n
5.1: fact ← fact*i
5.2: i ← i+1
Step 6: Display fact
Step 7: Stop
Algorithm 6: Find the Fibonacci series
• Step 1: Start
• Step 2: Declare variable a, b, c, n, i
• Step 3: Initialize variable a=0, b=1 and i=2
• Step 4: Read n from user
• Step 5: Print a and b
• Step 6: Repeat until i<=n :
Step 6.1: c=a+b
Step 6.2: print c
Step 6.3: a=b, b=c
Step 6.4: i=i+1
• Step 7: Stop
Algorithm to Reversing the digits of an
integer
• Step 1: Declare variable n, rev and rem as integer;
• Step 2: Read the number n;
• Step 3: while n not equal 0
{
rem=n%10;
rev=rev * 10 + rem;
n=n/10;
}
• Step 4: Print rev
Problem Solving Techniques notes for Unit 1
Problem Solving Techniques notes for Unit 1
Problem Solving Techniques notes for Unit 1
Problem Solving Techniques notes for Unit 1
Problem Solving Techniques notes for Unit 1
Problem Solving Techniques notes for Unit 1
GREATEST OF THREE
NUMBERS
FACTORIAL OF GIVEN
NUMBER
FIBONACCI SERIES
REVERSE THE GIVEN
NUMBER
Problem Solving Techniques notes for Unit 1
Algorithms as a technology
Analysing Algorithms
Problem Solving Techniques notes for Unit 1
Problem Solving Techniques notes for Unit 1
Problem Solving Techniques notes for Unit 1
Problem Solving Techniques notes for Unit 1
Designing algorithms

More Related Content

PPTX
Linked list
PDF
Problem solving techniques in c language
PDF
Problem Solving and Python Programming
PPTX
Functions in c language
PPTX
I/O Management
PPSX
Algorithm and flowchart
PPT
Lecture 5 - Structured Programming Language
PDF
Arrays in C++
Linked list
Problem solving techniques in c language
Problem Solving and Python Programming
Functions in c language
I/O Management
Algorithm and flowchart
Lecture 5 - Structured Programming Language
Arrays in C++

What's hot (20)

PPTX
How java differs from c and c++
PPTX
Algorithm and flowchart
PPTX
Pointer arithmetic in c
PPTX
Programming in c Arrays
PPTX
1. Fundamental Concept - Data Structures using C++ by Varsha Patil
PPTX
Data Structures (CS8391)
PPTX
Binary search
PDF
sparse matrix in data structure
PPTX
1. Arithmetic Operations - Addition and subtraction of signed numbers.pptx
PPTX
Binary Arithmetic
PPTX
Algorithm analysis and efficiency
PPTX
Data Structure and Algorithms
PDF
Manipulators
PPT
Chapter 2 Representation Of Algorithms 2
PPT
Searching in c language
PPTX
PPT
Binary operator overloading
PPTX
CONTROL STRUCTURE IN VB
PPTX
Event handling in Java(part 1)
PDF
Binomial queues
How java differs from c and c++
Algorithm and flowchart
Pointer arithmetic in c
Programming in c Arrays
1. Fundamental Concept - Data Structures using C++ by Varsha Patil
Data Structures (CS8391)
Binary search
sparse matrix in data structure
1. Arithmetic Operations - Addition and subtraction of signed numbers.pptx
Binary Arithmetic
Algorithm analysis and efficiency
Data Structure and Algorithms
Manipulators
Chapter 2 Representation Of Algorithms 2
Searching in c language
Binary operator overloading
CONTROL STRUCTURE IN VB
Event handling in Java(part 1)
Binomial queues
Ad

Similar to Problem Solving Techniques notes for Unit 1 (20)

PPTX
Design and Analysis of Algorithm ppt for unit one
PPT
AOA Week 01.ppt
PDF
Algorithms notes 2 tutorials duniya
PPTX
Algorithm in data structure bca .pptx
PDF
Lecture 2 role of algorithms in computing
PPT
UNIT-1-PPTS-DAA INTRO WITH DIVIDE AND CONQUER
PPT
UNIT 1- Design Analysis of algorithms and its working
PPT
UNIT-1-PPTS-DAA_INTRODUCTION_TO_DAA_GH.ppt
PDF
Algorithm Analysis.pdf
PPTX
Chp-1 DAA (2).pptx design analysis and algoritham presentation
PPTX
What is algorithm
PDF
Chapter-1-Introduction-to-Aglorithms.pdf
PPT
UNIT-1-PPTS-DAA.ppt
PPT
UNIT-1-PPTS-DAA.ppt
PPT
Introduction to Design Algorithm And Analysis.ppt
PPTX
Binary to hexadecimal algorithmic old.pptx
PPTX
Algorithm and flowchart with pseudo code
PPT
introegthnhhdfhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhppt
PPTX
UNIT-1.pptx python for engineering first year students
PPSX
Ds03 part i algorithms by jyoti lakhani
Design and Analysis of Algorithm ppt for unit one
AOA Week 01.ppt
Algorithms notes 2 tutorials duniya
Algorithm in data structure bca .pptx
Lecture 2 role of algorithms in computing
UNIT-1-PPTS-DAA INTRO WITH DIVIDE AND CONQUER
UNIT 1- Design Analysis of algorithms and its working
UNIT-1-PPTS-DAA_INTRODUCTION_TO_DAA_GH.ppt
Algorithm Analysis.pdf
Chp-1 DAA (2).pptx design analysis and algoritham presentation
What is algorithm
Chapter-1-Introduction-to-Aglorithms.pdf
UNIT-1-PPTS-DAA.ppt
UNIT-1-PPTS-DAA.ppt
Introduction to Design Algorithm And Analysis.ppt
Binary to hexadecimal algorithmic old.pptx
Algorithm and flowchart with pseudo code
introegthnhhdfhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhppt
UNIT-1.pptx python for engineering first year students
Ds03 part i algorithms by jyoti lakhani
Ad

More from SATHYABAMAMADHANKUMA (20)

PDF
Functional Dependencies and Normalization for Relational Databases
PDF
Functional Dependencies and Normalization for Relational Databases
PDF
SPM MODULE - 1 - PPT - MCA VTU SPM NOTES UNIT 1
PPTX
SOFTSKILLS and its types and the explanation
PPTX
introduction about software engineering for mca srudents
PPTX
WEB PRORAMMING NOTES WITH EXAMPLE PROGRAMS
PPTX
DOC-20241022-WA0000[1] - Read-Only.pptx
PDF
Blooms_Taxonomy. Revised for setting question papers for all kind of exams
PPT
1. Introduction to OS.ppt
PPTX
Client Side Scripting.pptx
PPT
2. Relational Algebra.ppt
PPT
1. UNIT - III.ppt
PPT
OK_Unit - I Multidisciplinary nature of environmental studies.ppt
PPT
Unit - II - Eco Systems.ppt
PPT
Unit - III Natural Resources.ppt
PPT
WP - Unit I.ppt
PPT
5-Recovery.ppt
PPTX
6.RISK MANAGEMENT.pptx
PPT
DBMS-CPD.ppt
PDF
system prgramming - loaders-linkers.pdf
Functional Dependencies and Normalization for Relational Databases
Functional Dependencies and Normalization for Relational Databases
SPM MODULE - 1 - PPT - MCA VTU SPM NOTES UNIT 1
SOFTSKILLS and its types and the explanation
introduction about software engineering for mca srudents
WEB PRORAMMING NOTES WITH EXAMPLE PROGRAMS
DOC-20241022-WA0000[1] - Read-Only.pptx
Blooms_Taxonomy. Revised for setting question papers for all kind of exams
1. Introduction to OS.ppt
Client Side Scripting.pptx
2. Relational Algebra.ppt
1. UNIT - III.ppt
OK_Unit - I Multidisciplinary nature of environmental studies.ppt
Unit - II - Eco Systems.ppt
Unit - III Natural Resources.ppt
WP - Unit I.ppt
5-Recovery.ppt
6.RISK MANAGEMENT.pptx
DBMS-CPD.ppt
system prgramming - loaders-linkers.pdf

Recently uploaded (20)

PDF
Weekly quiz Compilation Jan -July 25.pdf
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
A systematic review of self-coping strategies used by university students to ...
PDF
Complications of Minimal Access Surgery at WLH
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PDF
RMMM.pdf make it easy to upload and study
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PDF
Yogi Goddess Pres Conference Studio Updates
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
Trump Administration's workforce development strategy
PPTX
master seminar digital applications in india
PDF
Computing-Curriculum for Schools in Ghana
Weekly quiz Compilation Jan -July 25.pdf
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
O7-L3 Supply Chain Operations - ICLT Program
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Final Presentation General Medicine 03-08-2024.pptx
A systematic review of self-coping strategies used by university students to ...
Complications of Minimal Access Surgery at WLH
STATICS OF THE RIGID BODIES Hibbelers.pdf
O5-L3 Freight Transport Ops (International) V1.pdf
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
202450812 BayCHI UCSC-SV 20250812 v17.pptx
RMMM.pdf make it easy to upload and study
Microbial disease of the cardiovascular and lymphatic systems
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
Yogi Goddess Pres Conference Studio Updates
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Anesthesia in Laparoscopic Surgery in India
Trump Administration's workforce development strategy
master seminar digital applications in india
Computing-Curriculum for Schools in Ghana

Problem Solving Techniques notes for Unit 1

  • 1. UNIT - 1 Introduction: The Role of Algorithms in Computing, Algorithms as a technology, Analyzing algorithms, Designing algorithms, Growth of Functions, Asymptotic notation, Standard notations and common functions. Fundamental Algorithms: Exchanging the values of two variables, Counting, Summation of a set of numbers, Factorial Computation, Generating of the Fibonacci sequence, Reversing the digits of an integer, Character to number conversion.
  • 2. Problem solving •It is a systematic approach to find and implement the solution to a problem. Program •It is a set of instructions written in computer languages Software •It is a collection of computer program (or) data and instructions. •It is responsible for controlling, integration and managing hardware components and perform specific tasks.
  • 3. Classifications of software System software •It is a set of one or more programs that manage and support a computer system hardware and its data processing activities. •Ex: Operating system, Compilers, Assemblers Application software •It is a set of one or more programs, designed to solve a specific problem or a specific task. •Ex: Ms-Word ,Ms-Excel, Ms-Powerpoint
  • 4. Steps in Problem Solving 1. Problem Definition 2. Problem Analysis 3. Design 4. Coding 5. Testing 6. Maintenance
  • 5. 1. Problem Definition •To solve a problem, the first step is to identify and define the problem. •The problem must be stated clearly, accurately and precisely. •Ex: Find largest of three numbers
  • 6. 2. Problem Analysis The problem analysis helps in designing and coding for that particular problem. 1. Input specifications •The number of inputs and what forms the input are available 2.Output specifications •The number of outputs and what forms the output should be displayed. Ex: •input – a,b,c •output – a (or) b (or) c
  • 7. 3. Designing a program Algorithms •Algorithm - step by step procedure of solving a problem Flowcharts •Flowcharts – It is the graphical representation of the algorithm.
  • 8. 4. Coding • Writing instructions in a particular language to solve a problem. 5. Testing a Program • After writing a program, programmer needs to test the program for completeness, correctness, reliability and maintainability. • Unit testing • Program Testing • Verification Testing • Validation Testing
  • 9. 6. Maintaining the program •It means periodic review of the programs and modifications based on user requirements.
  • 10. What is an Algorithm? •In computer programming terms, an algorithm is a set of well-defined instructions to solve a particular problem. It takes a set of input(s) and produces the desired output. For example, •An algorithm to add two numbers: 1. Take two number inputs 2. Add numbers using the + operator 3. Store the result 4. Display the result Hint: Need of the Algorithm: Algorithms are used to solve problems or automate tasks in a systematic and efficient manner. They are a set of instructions or rules that guide the computer or software in performing a particular task or solving a problem.
  • 11. Qualities of a Good Algorithm •Input and output should be defined precisely. •Each step in the algorithm should be clear and unambiguous. •Algorithms should be most effective among many different ways to solve a problem. •An algorithm shouldn't include computer code. Instead, the algorithm should be written in such a way that it can be used in different programming languages.
  • 12. Characteristics of an algorithm The characteristics of an algorithm are •(i) Algorithm must have finite number of steps. •(ii) No instructions should be repeated. •(iii) An algorithm should be simple. •(iii) An algorithm must take atleast one or more input values. •(iv) An algorithm must provide atleast one or more output values.
  • 14. Advantages •Algorithms are very easy to understand. •Algorithm is programming language independent. •Algorithm makes the problem simple, clear, correct.
  • 15. The Role of Algorithms • Algorithms play a crucial role in computing by providing a set of instructions for a computer to perform a specific task. • They are used to solve problems and carry out tasks in computer systems, such as sorting data, searching for information, image processing, and much more. • An algorithm defines the steps necessary to produce the desired outcome, and the computer follows the instructions to complete the task efficiently and accurately.
  • 16. Role of Algorithm in Applications
  • 17. Role of Algorithm in Computing
  • 18. Role of Algorithm in Networking
  • 19. Algorithm to Add two numbers entered by the user • Step 1: Start • Step 2: Declare variables num1, num2 and sum. • Step 3: Read values num1 and num2. • Step 4: Add num1 and num2 and assign the result to sum. • sum←num1+num2 • Step 5: Display sum • Step 6: Stop
  • 20. Algorithm for Swapping two numbers using third variable: Step 1: Declare a variable a,b and c as integer; Step 2: Read two numbers a and b; Step 3: c=a; Step 4: a=b; Step 5: b=c; Step 6: Print a and b STEP 1: START STEP 2: ENTER A, B STEP 3: PRINT A, B STEP 4: A = A + B STEP 5: B= A - B STEP 6: A =A - B STEP 7: PRINT A, B STEP 8: END Algorithm for Swapping two numbers without using third variable:
  • 21. Algorithm to find Summation of a set of numbers Step 1: Start Step 2: Read the number n Step 3: Calculate the sum of n natural number, sum = n * (n + 1) / 2 Step 4: Display sum Step 5: End
  • 22. Algorithm to find count of numbers of digits in a number • Step 1: Declare variable a and n; //n variable is used for counting • Step 2: Read number a; • Step 3: while(a not equal 0) • a=a/10; • n=n+1; • end • Step 4: Print n; • Step 5: End
  • 23. Algorithm to Find the largest number among three numbers Step 1: Start Step 2: Declare variables a,b and c. Step 3: Read variables a,b and c. Step 4: If a > b If a > c Display a is the largest number. Else Display c is the largest number. Else If b > c Display b is the largest number. Else Display c is the greatest number. Step 5: Stop
  • 24. Algorithm to Find the factorial of a number Step 1: Start Step 2: Declare variables n, fact and i. Step 3: Initialize variables fact← 1 i ← 1 Step 4: Read value of n Step 5: Repeat the steps until i = n 5.1: fact ← fact*i 5.2: i ← i+1 Step 6: Display fact Step 7: Stop
  • 25. Algorithm 6: Find the Fibonacci series • Step 1: Start • Step 2: Declare variable a, b, c, n, i • Step 3: Initialize variable a=0, b=1 and i=2 • Step 4: Read n from user • Step 5: Print a and b • Step 6: Repeat until i<=n : Step 6.1: c=a+b Step 6.2: print c Step 6.3: a=b, b=c Step 6.4: i=i+1 • Step 7: Stop
  • 26. Algorithm to Reversing the digits of an integer • Step 1: Declare variable n, rev and rem as integer; • Step 2: Read the number n; • Step 3: while n not equal 0 { rem=n%10; rev=rev * 10 + rem; n=n/10; } • Step 4: Print rev
  • 38. Algorithms as a technology