Design and Analysis Introduction
Design and Analysis Introduction
Algorithm Design
The important aspects of algorithm design include creating an efficient algorithm to
solve a problem in an efficient way using minimum time and space.
To solve a problem, different approaches can be followed. Some of them can be
efficient with respect to time consumption, whereas other approaches may be memory
efficient. However, one has to keep in mind that both time consumption and memory
usage cannot be optimized simultaneously. If we require an algorithm to run in lesser
time, we have to invest in more memory and if we require an algorithm to run with lesser
memory, we need to have more time.
Problem definition
Development of a model
Specification of an Algorithm
Designing an Algorithm
Checking the correctness of an Algorithm
Analysis of an Algorithm
Implementation of an Algorithm
Program testing
Documentation
Characteristics of Algorithms
The main characteristics of algorithms are as follows −
Algorithms must have a unique name
Algorithms should have explicitly defined set of inputs and outputs
Algorithms are well-ordered with unambiguous operations
Algorithms halt in a finite amount of time. Algorithms should not run for infinity,
i.e., an algorithm must end at some point
Pseudocode
Pseudocode gives a high-level description of an algorithm without the ambiguity
associated with plain text but also without the need to know the syntax of a particular
programming language.
The running time can be estimated in a more general manner by using Pseudocode to
represent the algorithm as a set of fundamental operations which can then be counted.
Asymptotic Notations
Asymptotic notations are the mathematical notations used to describe the
running time of an algorithm when the input tends towards a particular value
or a limiting value.
For example: In bubble sort, when the input array is already sorted, the time
taken by the algorithm is linear i.e. the best case.
But, when the input array is in reverse condition, the algorithm takes the
maximum time (quadratic) to sort the elements i.e. the worst case.
When the input array is neither sorted nor in reverse order, then it takes
average time. These durations are denoted using asymptotic notations.
Big-O notation
Omega notation
Theta notation