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

Design & Analysis of Algorithm

Design & analysis of algorithm for software
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Design & Analysis of Algorithm

Design & analysis of algorithm for software
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Design and

Analysis of
Algorithm
By Khuram Chattha
Algorithm

An algorithm is a finite set of instructions, those if followed,


accomplishes a particular task. It is not language specific, we can use
any language and symbols to represent instructions.
In theoretical analysis of algorithms, it is common to estimate their
complexity in the asymptotic sense, i.e., to estimate the complexity
function for arbitrarily large input. The term "analysis of
algorithms" was coined by Donald Knuth.
 Analysis of algorithms is the determination of the amount of time and
space resources required to execute it.
 Usually, the efficiency or running time of an algorithm is stated as a
function relating the input length to the number of steps, known
as time complexity, or volume of memory, known as space
complexity.
Need for Analysis
 we will discuss the need for analysis of algorithms and how to choose
a better algorithm for a particular problem as one computational
problem can be solved by different algorithms.
 By considering an algorithm for a specific problem, we can begin to
develop pattern recognition so that similar types of problems can be
solved by the help of this algorithm.
 Algorithms are often quite different from one another, though the
objective of these algorithms are the same. For example, we know
that a set of numbers can be sorted using different algorithms.
Number of comparisons performed by one algorithm may vary with
others for the same input. Hence, time complexity of those
algorithms may differ. At the same time, we need to calculate the
memory space required by each algorithm.
Process of Analysis
Analysis of algorithm is the process of analyzing the problem-solving
capability of the algorithm in terms of the time and size required (the
size of memory for storage while implementation). However, the main
concern of analysis of algorithms is the required time or performance.
Generally, we perform the following types of analysis.
 Worst-case − The maximum number of steps taken on any instance
of size a.
 Best-case − The minimum number of steps taken on any instance of
size a.
 Average case − An average number of steps taken on any instance
of size a.
 Amortized − A sequence of operations applied to the input of
size a averaged over time.
Time & Space Complexities

In this context, if we compare bubble sort and merge sort. Bubble sort
does not require additional memory, but merge sort requires additional
space. Though time complexity of bubble sort is higher compared to
merge sort, we may need to apply bubble sort if the program needs to
run in an environment, where memory is very limited.
Complexities of an Algorithm
The complexity of an algorithm computes the amount of time and
spaces required by an algorithm for an input of size (n). The complexity
of an algorithm can be divided into two types. The time
complexity and the space complexity.
1. Time Complexity of an Algorithm
The time complexity is defined as the process of determining a formula
for total time required towards the execution of that algorithm. This
calculation is totally independent of implementation and programming
language.
2. Space Complexity of an Algorithm
Space complexity is defining as the process of defining a formula for
prediction of how much memory space is required for the successful
execution of the algorithm. The memory space is generally considered
as the primary memory.
Rate of Growth

Rate of growth is defined as the rate at which the running time of the
algorithm is increased when the input size is increased.
 The growth rate could be categorized into two types:
linear and exponential. If the algorithm is increased in a linear way
with an increasing in input size, it is linear growth rate. And if the
running time of the algorithm is increased exponentially with the
increase in input size, it is exponential growth rate.

You might also like