0% found this document useful (0 votes)
11 views12 pages

Algrothim

The document explains the concept of algorithms and their role in computer programming, emphasizing that algorithms are step-by-step instructions for solving problems. It outlines characteristics of good algorithms, advantages, and disadvantages, and provides examples of algorithms for tasks like making an omelet and adding two numbers. The text highlights that while computers lack inherent intelligence, software and algorithms enable them to perform complex tasks effectively.

Uploaded by

happy9865527792
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views12 pages

Algrothim

The document explains the concept of algorithms and their role in computer programming, emphasizing that algorithms are step-by-step instructions for solving problems. It outlines characteristics of good algorithms, advantages, and disadvantages, and provides examples of algorithms for tasks like making an omelet and adding two numbers. The text highlights that while computers lack inherent intelligence, software and algorithms enable them to perform complex tasks effectively.

Uploaded by

happy9865527792
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

ALGORITHM

What makes a computer Intelligent?

➢We all know that a computer itself is non


intelligence machine because it doesn’t have
capacity to think, It doesn’t capacity to make any
decision, and it doesn’t have capacity to think
what to do?
➢But still it is being used in almost all field, it is
being able to solve varieties of problems.
➢This is due to presence of software in it.
➢It is the software that makes computer to make any
decision and solve a given problem.
❖A program is a set of well defined instructions written
in computer language.
❖An instruction is a command given to computer to do a
task.
❖A computer acts according to command given to it.
❖A collective package of well defined instruction is a
program.
❖A programmer writes a program after developing an
algorithm and drawing a flowchart as follow:-
ALGORITHM FLOWCHART PROGRAM

❖ Once the algorithm is ready, it becomes easy to code


program. In fact, algorithm and flowchart is a roadmap to
solution of the program.
❖ Algorithm is descriptive solution of the problem.
❖ Flowchart is the pictorial solution of the problem.
❖ Lets us analyze algorithm and flowchart separately.
ALGORITHM
➢ An Algorithm is a sequence of step by step actions to be
taken to do a task.
➢ It can be viewed as stepwise procedure to do a task.
➢ An algorithm is a roadmap for solving a problem.
➢ The word “Algorithm” is named after a famous ninth
century Arabic author and mathematician “ABU JAFAR
MOHAMMED IBN MUSA AL KHOWARIZMI”.
➢ “An algorithm is a set of instructions to be carried out step
by step in order to produce the desired correct solution to
the problem. programming languages are the tools used to
implement the algorithm.”
EXAMPLE
Lets understand with the simple example, we have heard a recipe for
making an Omelet .The recipe tells the stepwise instructions to make
an omelet.
EXAMPLE 1:- Write an Algorithm to make an Omelet.
Step 1: Be ready (or start).
Step 2: Burn stove.
Step 3: Put the pan on the stove.
Step 4: Mix the liquid of an egg, salt, onion.
Step 5: Pour the mixture in the pan.
Step 6: Fry it property.
Step 7: Stop
You have an omelet. Yes the sequence of the stepwise
instructions to make omelet is an Algorithm. It would be better to
understand the concept of an Algorithm with a proper example.
An algorithm to add any two numbers
 Start
 Read two numbers from user
 Assign these numbers in two variables x and y
 Add the value of x and y put the result in the third
variable z
 Display the value of z
 Stop
Another way

 Start
 Read x and y
 z=x + y
 Print z
 Stop
Check the no is positive or negative

 Start
 Read a number n
 If n>0 then
 “The number is positive”
 Otherwise
 “The number is negative”
 End
Characteristics of a good algorithm
 Input- An algorithm may take a zero or any number of inputs. The
number of inputs taken by an algorithm depends upon the nature of
the problem.
 Output – An algorithm must produce one or more outputs. To put in
other word, every algorithm must give solution to the problem in the
form of output.
 Termination or fitness – An algorithm must terminate after a finite
number of steps. It should end after a certain time. This should not
enter into to an infinite loop.
 Generality – It indicates that the algorithm for a problem should be
general. It means the algorithm should work for all the values.
 Effectiveness – It says that the operation must be simple and should be
done in a finite time to produce effective result.
 Definiteness – It denotes that each instruction written in algorithm
must be clear, well-defined and precise.
Advantages of Good Algorithm
 It is a program design tool.
 It is programming language independent.
 An algorithm gives solution of a problem.
 A non technical person can easily understand it.
 A single algorithm can be used to solve several similar
problems.
Disadvantages of Algorithm
 Experience programmers think that writing an
algorithm is a waste of time and resource because they
can write a program directly.
 Although, it gives logic of the problem, but is far away
from source code.(Pseudo code is very near to the
source code.)

You might also like