SlideShare a Scribd company logo
1 of 14
A computer is a very powerful and versatile machine capable of performing a
multitude of different tasks
Intelligence Quotient (I.Q) of a computer is zero
A computer performs many tasks exactly in the same manner as it is told to do
Responsibility on the user to instruct the computer in a correct and precise manner, so
that the machine is able to perform the required job in a proper way
The user must have clear understanding of the problem to be solved
Once the problem is well-defined and a method of solving it is developed, then
instructing he computer to solve the problem becomes relatively easier task
It is necessary to formulate or define the problem in a precise manner
A computer cannot solve a problem on its own.
One has to provide step by step solutions of the problem to the computer.
In fact, the task of problem solving is not that of the computer.
It is the programmer who has to write down the solution to the problem in terms of
simple operations which the computer can understand and execute.
In order to solve a problem by the computer, one has to pass though certain stages or
steps.
They are
1. Understanding the problem
2. Analyzing the problem
3. Developing the solution
4. Coding and implementation.
1. Understanding the problem: Here we try to understand the problem to be solved in
totally. Before with the next stage or step, we should be absolutely sure about the
objectives of the given problem.
2. Analyzing the problem: After understanding thoroughly the problem to be solved, we
look different ways of solving the problem and evaluate each of these methods. The
idea here is to search an appropriate solution to the problem under consideration.
The end result of this stage is a broad overview of the sequence of operations that
are to be carries out to solve the given problem.
3. Developing the solution: Here the overview of the sequence of operations that was
the result of analysis stage is expanded to form a detailed step by step solution to the
problem under consideration.
4. Coding and implementation: The last stage of the problem solving is the conversion
of the detailed sequence of operations in to a language that the computer can
understand. Here each step is converted to its equivalent instruction or instructions in
the computer language that has been chosen for the implantation
Algorithm
A set of sequential steps usually written in Ordinary Language to solve a given problem
is called Algorithm.
The most important factor in the choice of algorithm is the time requirement to execute
it, after writing code in High-level language with the help of a computer.
The algorithm which will need the least time when executed is considered the best.
An algorithm can be defined as “a complete, unambiguous, finite number of logical
steps for solving a specific problem “
Step1. Identification of input: For an algorithm, there are quantities to be supplied called
input and these are fed externally. The input is to be indentified first for any specified
problem.
Step2: Identification of output: From an algorithm, at least one quantity is produced,
called for any specified problem.
Step3 : Identification the processing operations : All the calculations to be performed in
order to lead to output from the input are to be identified in an orderly manner.
Step4 : Processing Definiteness : The instructions composing the algorithm must be clear
and there should not be any ambiguity in them.
Step5 : Processing Finiteness : If we go through the algorithm, then for all cases, the
algorithm should terminate after a finite number of steps.
Step6 : Possessing Effectiveness : The instructions in the algorithm must be sufficiently
basic and in practice they can be carries out easily
An algorithm must possess the following properties
1. Finiteness: An algorithm must terminate in a finite number of steps
2. Definiteness: Each step of the algorithm must be precisely and unambiguously stated
3. Effectiveness: Each step must be effective, in the sense that it should be primitive
easily convert able into program statement) can be performed exactly in a finite
amount of time.
4. Generality: The algorithm must be complete in itself so that it can be used to solve
problems of a specific type for any input data.
5. Input/output: Each algorithm must take zero, one or more quantities as input data
produce one or more output values. An algorithm can be written in English like
sentences or in any standard representation sometimes, algorithm written in English
like languages are called Pseudo Code.
Example 1: Suppose we want to find the average of three numbers,
the algorithm is as follows
Step 1 Read the numbers a, b, c
Step 2 Compute the sum of a, b and c
Step 3 Divide the sum by 3
Step 4 Store the result in variable d
Step 5 Print the value of d Step
6 End of the program
Example 2: Write an algorithm to calculate the simple interest using the
formula. Simple interest = P*N* R/100. Where P is principle Amount, N is the
number of years and R is the rate of interest.
the algorithm is as follows
Step 1: Read the three input quantities’ P, N and R.
Step 2 : Calculate simple interest as Simple interest = P* N* R/100
Step 3: Print simple interest.
Step 4: Stop.
Example 3: Write an algorithm to find the area of the triangle. Let b, c be
the sides of the triangle ABC and A the included angle between the given sides.
the algorithm is as follows
Step 1: Input the given elements of the triangle namely sides b, c and angle
between the sides A.
Step 2: Area = (1/2) *b*C* sin A
Step 3: Output the Area
Step 4: Stop.
Write an algorithm to find the largest of three numbers X, Y,Z.
Step 1: Read the numbers X,Y,Z.
Step 2: if (X > Y) Big = X else BIG = Y
Step 3 : if (BIG < Z)
Step 4: Big = Z
Step 5: Print the largest number i.e. Big
Step 6: Stop.
Write down an algorithm to find the largest data value of a set of given data values
Algorithm largest of all data values:
Step 1: LARGE <- 0
Step 2: read NUM
Step 3: While NUM > = 0 do
3.1 if NUM > LARGE
3.1.1 then
3.1.1.1 LARGE <- NUM
3.2. read NUM
Step 4: Write “largest data value is”, LARGE
Step 5: end.
Write an algorithm which will test whether a given integer value is prime or not.
Algorithm prime testing:
Step 1: M <- 2
Step 2: read N
Step 3: MAX <- SQRT (N)
Step 4: While M < = MAX do
4.1 if (M* (N/M) = N
4.1.1 then
4.1.1.1 go to step 7
4.2. M <- M + 1
Step 5: Write “number is prime”
Step 6: go to step 8
Step 7: Write “number is not a prime”
Step 8: end.
Write algorithm to find the factorial of a given number N
Step 1: PROD <- 1
Step 2: I <- 0
Step 3: read N
Step 4: While I < N do
4.1 I <- I + 1
4.2. PROD <- PROD* I
Step 5: Write “Factorial of”, N, “is”, PROD
Step 6: end.
Write an algorithm to find sum of given data values until negative value is entered.
Algorithm Find – Sum
Step 1: SUM <- 0
Step 2: I <- 0
Step 3: read NEW VALUE
Step 4: While NEW VALUE <= 0 do
4.1 SUM <- SUM + NEW VALUE
4.2 I <- I + 1
4.3 read NEW VALUE
Step 5: Write “Sum of”, I, “data value is, “SUM
Step 6: END

More Related Content

Similar to Algorithm types performance steps working

01 Introduction to analysis of Algorithms.pptx
01 Introduction to analysis of Algorithms.pptx01 Introduction to analysis of Algorithms.pptx
01 Introduction to analysis of Algorithms.pptxssuser586772
 
2-Algorithms and Complexit data structurey.pdf
2-Algorithms and Complexit data structurey.pdf2-Algorithms and Complexit data structurey.pdf
2-Algorithms and Complexit data structurey.pdfishan743441
 
Algorithms notes 2 tutorials duniya
Algorithms notes 2   tutorials duniyaAlgorithms notes 2   tutorials duniya
Algorithms notes 2 tutorials duniyaTutorialsDuniya.com
 
Unit 1 python (2021 r)
Unit 1 python (2021 r)Unit 1 python (2021 r)
Unit 1 python (2021 r)praveena p
 
Basics of Algorithm Unit 1 part 1 algorithm
Basics of Algorithm Unit 1 part 1  algorithmBasics of Algorithm Unit 1 part 1  algorithm
Basics of Algorithm Unit 1 part 1 algorithmJIMS LAJPAT NAGAR
 
Chapter 2(1)
Chapter 2(1)Chapter 2(1)
Chapter 2(1)TejaswiB4
 
Program concep sequential statements
Program concep sequential statementsProgram concep sequential statements
Program concep sequential statementsankurkhanna
 
AOA Week 01.ppt
AOA Week 01.pptAOA Week 01.ppt
AOA Week 01.pptINAM352782
 
Data structures algorithms basics
Data structures   algorithms basicsData structures   algorithms basics
Data structures algorithms basicsayeshasafdar8
 
19IS402_LP1_LM_22-23.pdf
19IS402_LP1_LM_22-23.pdf19IS402_LP1_LM_22-23.pdf
19IS402_LP1_LM_22-23.pdfGOWTHAMR721887
 
C language algorithms
C language algorithmsC language algorithms
C language algorithmscprogram
 

Similar to Algorithm types performance steps working (20)

UNIT-2-PPTS-DAA.ppt
UNIT-2-PPTS-DAA.pptUNIT-2-PPTS-DAA.ppt
UNIT-2-PPTS-DAA.ppt
 
01 Introduction to analysis of Algorithms.pptx
01 Introduction to analysis of Algorithms.pptx01 Introduction to analysis of Algorithms.pptx
01 Introduction to analysis of Algorithms.pptx
 
2-Algorithms and Complexit data structurey.pdf
2-Algorithms and Complexit data structurey.pdf2-Algorithms and Complexit data structurey.pdf
2-Algorithms and Complexit data structurey.pdf
 
Algorithms notes 2 tutorials duniya
Algorithms notes 2   tutorials duniyaAlgorithms notes 2   tutorials duniya
Algorithms notes 2 tutorials duniya
 
Unit 1 python (2021 r)
Unit 1 python (2021 r)Unit 1 python (2021 r)
Unit 1 python (2021 r)
 
Algorithm.pdf
Algorithm.pdfAlgorithm.pdf
Algorithm.pdf
 
Problem solving methodology
Problem solving methodologyProblem solving methodology
Problem solving methodology
 
Basics of Algorithm Unit 1 part 1 algorithm
Basics of Algorithm Unit 1 part 1  algorithmBasics of Algorithm Unit 1 part 1  algorithm
Basics of Algorithm Unit 1 part 1 algorithm
 
Practical 01 (detailed)
Practical 01 (detailed)Practical 01 (detailed)
Practical 01 (detailed)
 
Chapter 2(1)
Chapter 2(1)Chapter 2(1)
Chapter 2(1)
 
Program concep sequential statements
Program concep sequential statementsProgram concep sequential statements
Program concep sequential statements
 
AOA Week 01.ppt
AOA Week 01.pptAOA Week 01.ppt
AOA Week 01.ppt
 
DATA STRUCTURE.pdf
DATA STRUCTURE.pdfDATA STRUCTURE.pdf
DATA STRUCTURE.pdf
 
DATA STRUCTURE
DATA STRUCTUREDATA STRUCTURE
DATA STRUCTURE
 
Data structures algorithms basics
Data structures   algorithms basicsData structures   algorithms basics
Data structures algorithms basics
 
Lesson 3
Lesson 3Lesson 3
Lesson 3
 
UNIT 1.pptx
UNIT 1.pptxUNIT 1.pptx
UNIT 1.pptx
 
19IS402_LP1_LM_22-23.pdf
19IS402_LP1_LM_22-23.pdf19IS402_LP1_LM_22-23.pdf
19IS402_LP1_LM_22-23.pdf
 
C language algorithms
C language algorithmsC language algorithms
C language algorithms
 
C++ good tutorial
C++ good tutorialC++ good tutorial
C++ good tutorial
 

More from Saurabh846965

Types_of_Access_Controlsggggggggggggggggg
Types_of_Access_ControlsgggggggggggggggggTypes_of_Access_Controlsggggggggggggggggg
Types_of_Access_ControlsgggggggggggggggggSaurabh846965
 
Cache-Memory for university courses at PG
Cache-Memory for university courses at PGCache-Memory for university courses at PG
Cache-Memory for university courses at PGSaurabh846965
 
Authentication and authorization difference
Authentication and authorization differenceAuthentication and authorization difference
Authentication and authorization differenceSaurabh846965
 
Pattern Recognition Generalisation Abstraction.pptx
Pattern Recognition Generalisation Abstraction.pptxPattern Recognition Generalisation Abstraction.pptx
Pattern Recognition Generalisation Abstraction.pptxSaurabh846965
 
ABSTRACTION for data computing machines and
ABSTRACTION for data computing machines andABSTRACTION for data computing machines and
ABSTRACTION for data computing machines andSaurabh846965
 
Data and Information Details and Differences
Data and Information Details and DifferencesData and Information Details and Differences
Data and Information Details and DifferencesSaurabh846965
 
Social Science Flow Sheet - Padhle.pdf
Social Science Flow Sheet - Padhle.pdfSocial Science Flow Sheet - Padhle.pdf
Social Science Flow Sheet - Padhle.pdfSaurabh846965
 
Mentor-Mentee_Meeting_Record(Form).pdf
Mentor-Mentee_Meeting_Record(Form).pdfMentor-Mentee_Meeting_Record(Form).pdf
Mentor-Mentee_Meeting_Record(Form).pdfSaurabh846965
 
Elite Batch & Hacker Rank Analysis.pptx
Elite Batch & Hacker Rank Analysis.pptxElite Batch & Hacker Rank Analysis.pptx
Elite Batch & Hacker Rank Analysis.pptxSaurabh846965
 

More from Saurabh846965 (12)

Types_of_Access_Controlsggggggggggggggggg
Types_of_Access_ControlsgggggggggggggggggTypes_of_Access_Controlsggggggggggggggggg
Types_of_Access_Controlsggggggggggggggggg
 
Cache-Memory for university courses at PG
Cache-Memory for university courses at PGCache-Memory for university courses at PG
Cache-Memory for university courses at PG
 
Authentication and authorization difference
Authentication and authorization differenceAuthentication and authorization difference
Authentication and authorization difference
 
Pattern Recognition Generalisation Abstraction.pptx
Pattern Recognition Generalisation Abstraction.pptxPattern Recognition Generalisation Abstraction.pptx
Pattern Recognition Generalisation Abstraction.pptx
 
ABSTRACTION for data computing machines and
ABSTRACTION for data computing machines andABSTRACTION for data computing machines and
ABSTRACTION for data computing machines and
 
Data and Information Details and Differences
Data and Information Details and DifferencesData and Information Details and Differences
Data and Information Details and Differences
 
NAC_p3.pptx
NAC_p3.pptxNAC_p3.pptx
NAC_p3.pptx
 
Social Science Flow Sheet - Padhle.pdf
Social Science Flow Sheet - Padhle.pdfSocial Science Flow Sheet - Padhle.pdf
Social Science Flow Sheet - Padhle.pdf
 
Mentor-Mentee_Meeting_Record(Form).pdf
Mentor-Mentee_Meeting_Record(Form).pdfMentor-Mentee_Meeting_Record(Form).pdf
Mentor-Mentee_Meeting_Record(Form).pdf
 
powershell.pdf
powershell.pdfpowershell.pdf
powershell.pdf
 
Elite Batch & Hacker Rank Analysis.pptx
Elite Batch & Hacker Rank Analysis.pptxElite Batch & Hacker Rank Analysis.pptx
Elite Batch & Hacker Rank Analysis.pptx
 
unit-3.pdf
unit-3.pdfunit-3.pdf
unit-3.pdf
 

Recently uploaded

chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxhumanexperienceaaa
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 

Recently uploaded (20)

chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 

Algorithm types performance steps working

  • 1. A computer is a very powerful and versatile machine capable of performing a multitude of different tasks Intelligence Quotient (I.Q) of a computer is zero A computer performs many tasks exactly in the same manner as it is told to do Responsibility on the user to instruct the computer in a correct and precise manner, so that the machine is able to perform the required job in a proper way The user must have clear understanding of the problem to be solved Once the problem is well-defined and a method of solving it is developed, then instructing he computer to solve the problem becomes relatively easier task It is necessary to formulate or define the problem in a precise manner
  • 2. A computer cannot solve a problem on its own. One has to provide step by step solutions of the problem to the computer. In fact, the task of problem solving is not that of the computer. It is the programmer who has to write down the solution to the problem in terms of simple operations which the computer can understand and execute. In order to solve a problem by the computer, one has to pass though certain stages or steps. They are 1. Understanding the problem 2. Analyzing the problem 3. Developing the solution 4. Coding and implementation.
  • 3. 1. Understanding the problem: Here we try to understand the problem to be solved in totally. Before with the next stage or step, we should be absolutely sure about the objectives of the given problem. 2. Analyzing the problem: After understanding thoroughly the problem to be solved, we look different ways of solving the problem and evaluate each of these methods. The idea here is to search an appropriate solution to the problem under consideration. The end result of this stage is a broad overview of the sequence of operations that are to be carries out to solve the given problem. 3. Developing the solution: Here the overview of the sequence of operations that was the result of analysis stage is expanded to form a detailed step by step solution to the problem under consideration. 4. Coding and implementation: The last stage of the problem solving is the conversion of the detailed sequence of operations in to a language that the computer can understand. Here each step is converted to its equivalent instruction or instructions in the computer language that has been chosen for the implantation
  • 4. Algorithm A set of sequential steps usually written in Ordinary Language to solve a given problem is called Algorithm. The most important factor in the choice of algorithm is the time requirement to execute it, after writing code in High-level language with the help of a computer. The algorithm which will need the least time when executed is considered the best. An algorithm can be defined as “a complete, unambiguous, finite number of logical steps for solving a specific problem “
  • 5. Step1. Identification of input: For an algorithm, there are quantities to be supplied called input and these are fed externally. The input is to be indentified first for any specified problem. Step2: Identification of output: From an algorithm, at least one quantity is produced, called for any specified problem. Step3 : Identification the processing operations : All the calculations to be performed in order to lead to output from the input are to be identified in an orderly manner. Step4 : Processing Definiteness : The instructions composing the algorithm must be clear and there should not be any ambiguity in them. Step5 : Processing Finiteness : If we go through the algorithm, then for all cases, the algorithm should terminate after a finite number of steps. Step6 : Possessing Effectiveness : The instructions in the algorithm must be sufficiently basic and in practice they can be carries out easily
  • 6. An algorithm must possess the following properties 1. Finiteness: An algorithm must terminate in a finite number of steps 2. Definiteness: Each step of the algorithm must be precisely and unambiguously stated 3. Effectiveness: Each step must be effective, in the sense that it should be primitive easily convert able into program statement) can be performed exactly in a finite amount of time. 4. Generality: The algorithm must be complete in itself so that it can be used to solve problems of a specific type for any input data. 5. Input/output: Each algorithm must take zero, one or more quantities as input data produce one or more output values. An algorithm can be written in English like sentences or in any standard representation sometimes, algorithm written in English like languages are called Pseudo Code.
  • 7. Example 1: Suppose we want to find the average of three numbers, the algorithm is as follows Step 1 Read the numbers a, b, c Step 2 Compute the sum of a, b and c Step 3 Divide the sum by 3 Step 4 Store the result in variable d Step 5 Print the value of d Step 6 End of the program
  • 8. Example 2: Write an algorithm to calculate the simple interest using the formula. Simple interest = P*N* R/100. Where P is principle Amount, N is the number of years and R is the rate of interest. the algorithm is as follows Step 1: Read the three input quantities’ P, N and R. Step 2 : Calculate simple interest as Simple interest = P* N* R/100 Step 3: Print simple interest. Step 4: Stop.
  • 9. Example 3: Write an algorithm to find the area of the triangle. Let b, c be the sides of the triangle ABC and A the included angle between the given sides. the algorithm is as follows Step 1: Input the given elements of the triangle namely sides b, c and angle between the sides A. Step 2: Area = (1/2) *b*C* sin A Step 3: Output the Area Step 4: Stop.
  • 10. Write an algorithm to find the largest of three numbers X, Y,Z. Step 1: Read the numbers X,Y,Z. Step 2: if (X > Y) Big = X else BIG = Y Step 3 : if (BIG < Z) Step 4: Big = Z Step 5: Print the largest number i.e. Big Step 6: Stop.
  • 11. Write down an algorithm to find the largest data value of a set of given data values Algorithm largest of all data values: Step 1: LARGE <- 0 Step 2: read NUM Step 3: While NUM > = 0 do 3.1 if NUM > LARGE 3.1.1 then 3.1.1.1 LARGE <- NUM 3.2. read NUM Step 4: Write “largest data value is”, LARGE Step 5: end.
  • 12. Write an algorithm which will test whether a given integer value is prime or not. Algorithm prime testing: Step 1: M <- 2 Step 2: read N Step 3: MAX <- SQRT (N) Step 4: While M < = MAX do 4.1 if (M* (N/M) = N 4.1.1 then 4.1.1.1 go to step 7 4.2. M <- M + 1 Step 5: Write “number is prime” Step 6: go to step 8 Step 7: Write “number is not a prime” Step 8: end.
  • 13. Write algorithm to find the factorial of a given number N Step 1: PROD <- 1 Step 2: I <- 0 Step 3: read N Step 4: While I < N do 4.1 I <- I + 1 4.2. PROD <- PROD* I Step 5: Write “Factorial of”, N, “is”, PROD Step 6: end.
  • 14. Write an algorithm to find sum of given data values until negative value is entered. Algorithm Find – Sum Step 1: SUM <- 0 Step 2: I <- 0 Step 3: read NEW VALUE Step 4: While NEW VALUE <= 0 do 4.1 SUM <- SUM + NEW VALUE 4.2 I <- I + 1 4.3 read NEW VALUE Step 5: Write “Sum of”, I, “data value is, “SUM Step 6: END