0% found this document useful (0 votes)
34 views

What Is An Algorithm

An algorithm is a step-by-step set of instructions to produce a desired output. It must be unambiguous, finite, and effective. An example algorithm multiplies two numbers by declaring integers, defining values, multiplying them, storing the result, and printing the output. While algorithms and programs are often used interchangeably, an algorithm is the underlying set of steps and a program is its implementation in a language. An algorithm must terminate to be considered such, while programs like operating systems utilize algorithms for individual terminating tasks.

Uploaded by

Ch Amir
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

What Is An Algorithm

An algorithm is a step-by-step set of instructions to produce a desired output. It must be unambiguous, finite, and effective. An example algorithm multiplies two numbers by declaring integers, defining values, multiplying them, storing the result, and printing the output. While algorithms and programs are often used interchangeably, an algorithm is the underlying set of steps and a program is its implementation in a language. An algorithm must terminate to be considered such, while programs like operating systems utilize algorithms for individual terminating tasks.

Uploaded by

Ch Amir
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

What is an Algorithm?

An algorithm is a step-by-step procedure that defines a set of instructions that must be carried out
in a specific order to produce the desired result. Algorithms are generally developed independently
of underlying languages, which means that an algorithm can be implemented in more than one
programming language. Fineness, effectiveness, and language independence are some of the
characteristics of an algorithm.
An algorithm is a set of commands that must be followed for a computer to perform calculations
or other problem-solving operations.
According to its formal definition, an algorithm is a finite set of instructions carried out in a specific
order to perform a particular task.
It is not the entire program or code; it is simple logic to a problem represented as an informal
description in the form of a flowchart or pseudocode.

5 Properties of Algorithm
Input: An algorithm requires some input values. An algorithm can be given a value other than 0 as
input.
Output: At the end of an algorithm, you will have one or more outcomes.
Unambiguity: A perfect algorithm is defined as unambiguous, which means that its instructions
should be clear and straightforward.
Finiteness: An algorithm must be finite. Finiteness in this context means that the algorithm should
have a limited number of instructions, i.e., the instructions should be countable.
Effectiveness: Because each instruction in an algorithm affects the overall process, it should be
adequate.
Algorithm Example
Problem: Create an algorithm that multiplies two numbers and displays the output.
Step 1 − Start
Step 2 − declare three integers x, y & z
Step 3 − define values of x & y
Step 4 − multiply values of x & y
Step 5 − store result of step 4 to z
Step 6 − print z
Step 7 – Stop

Programs
We often think of a computer program as an instance, or concrete representation, of an algorithm
in some programming language. Algorithms are usually presented in terms of programs, or parts
of programs. Naturally, there are many programs that are instances of the same algorithm, because
any modern computer programming language can be used to implement the same collection of
algorithms (although some programming languages can make life easier for the programmer). To
simplify presentation, people often use the terms “algorithm” and “program” interchangeably,
despite the fact that they are really separate concepts. By definition, an algorithm must provide
sufficient detail that it can be converted into a program when needed.

The requirement that an algorithm must terminate means that not all computer programs meet the
technical definition of an algorithm. Your operating system is one such program. However, you
can think of the various tasks for an operating system (each with associated inputs and outputs) as
individual problems, each solved by specific algorithms implemented by a part of the operating
system program, and each one of which terminates once its output is produced.

You might also like