You are on page 1of 3

Activity 01

1.1 Algorithm

What is ALGORITHM?
 A well-defined algorithm is a sequential computing method that provides the
output necessary to solve a problem by accepting a value or set of values as input.
 Another option is to state that an algorithm is considered accurate if and only if it
terminates with the right output for each input instance. Take into consideration a
"black box," or a container where nothing can be seen inside. The box accepts our
input and produces the desired output for us, but the process by which the input is
changed into the intended output is an ALGORITHM, which we may need to
understand. The language being used has no bearing on an algorithm. It reveals to
the programmer the methodology applied to resolve the issue.
 Every time you use your phone, computer, laptop, or calculator you are using
Algorithms. Similarly, algorithms help to do a task in programming to get the
expected output.

Figure 1:What is ALGORITHM


Properties of Algorithm:

 It should terminate after a finite time.


 It should produce at least one output.
 It should take zero or more input.
 It should be deterministic means giving the same output for the same input case.
 Every step in the algorithm must be effective every step should do some work.

Qualities of good algorithm

 Input and output should be defined precisely.


 Each steps in algorithm should be clear and unambiguous.
 Algorithm should be most effective among many different ways to solve a problem.
 An algorithm shouldn’t have computer code. Instead, the algorithm should be written
in such a way that, it can be used in similar programming languages.

What are the Characteristics of an Algorithm?

Figure 2:Characteristics of an Algorithm


As opposed to using the normal recipe's printed directions, one would not follow them. In
a similar vein, not all computer instructions written down are algorithms. Some
instructions must meet the following requirements in order to qualify as an algorithm:

 Clear and Unambiguous: The algorithm should be clear and unambiguous. Each
of its steps should be clear in all aspects and must lead to only one meaning.
 Well-Defined Inputs: If an algorithm says to take inputs, it should be well-defined
inputs.
 Well-Defined Outputs: The algorithm must clearly define what output will be
yielded and it should be well-defined as well.
 Finite-ness: The algorithm must be finite, i.e. it should terminate after a finite
time.
 Feasible: The algorithm must be simple, generic, and practical, such that it can be
executed with the available resources. It must not contain some future technology
or anything.
 Language Independent: The Algorithm designed must be language-independent, it
must be just plain instructions that can be implemented in any language, and yet
the output will be the same, as expected.

Linear Search

Linear search, often known as sequential search, is the most basic search technique. In
this type of search, you go through the entire list and try to fetch a match for a single
element. If you find a match, then the address of the matching target element is returned.

Figure 3:Linear Search

You might also like