BASIC CONCEPTS OF ALGORITHM
BASIC CONCEPTS OF ALGORITHM
G.SILAMBARASAN
ALGORITHM
• Algorithm is a step-by-step procedure, which defines a set of
instructions to be executed in a certain order to get the
desired output. Algorithms are generally created independent
of underlying languages, i.e. an algorithm can be implemented
in more than one programming language.
• From the data structure point of view, following are some
important categories of algorithms −
Search − Algorithm to search an item in a data structure.
Sort − Algorithm to sort items in a certain order.
Insert − Algorithm to insert item in a data structure.
Update − Algorithm to update an existing item in a data structure.
Delete − Algorithm to delete an existing item from a data structure.
Characteristics of an Algorithm
Algorithm: SUM(A, B)
Step 1 - START
Step 2 - C ← A + B + 10
Step 3 - Stop
Here we have three variables A, B, and C and one
constant. Hence S(P) = 1 + 3. Now, space
depends on data types of given variables and
constant types and it will be multiplied
accordingly.
Time Complexity
• (f(n)) = { g(n) if and only if g(n) = Ο(f(n)) and g(n) = Ω(f(n)) for
all n > n0. }