Introduction To Daa
Introduction To Daa
of Algorithm
Introduction to course
Introduction to Algorithm
References
➢ 1. Charles E. Leiserson, Thomas H. Cormen, Ronald L. Rivest, Clifford Stein - Introduction to
Algorithms, PHI
➢ Course Site:
https://sites.google.com/a/nirmauni.ac.in/3cs1
103---data-structures-and-algorithm/
➢ Evaluation Methodology:
LPW SEE CE
Exam Duration Continuous Evaluation of 3.0 Hrs Continuous Evaluation
lab + Semester Endexam
Component Weightage 20%(75+25) 40% 40%
(CT-35 +Sessional-35 +
Conceptual Test 30)
➢ An unambiguous sequence of computational steps that transform the input into the output.
981 981
1 23 4 1 23 4
3924 981
2943 1962
1962 2943
981 3924
1210554 1210554
➢ An algorithm is the thing which stays the same whether the program is in Pascal running on a
Cray in New York or is in BASIC running on a Macintosh in Kathmandu!
➢ An algorithm is any well-defined computational procedure that takes some value, or set of
values, as input and produces some value, or set of values, as output. An algorithm is thus a
sequence of computational steps that transform the input into the output.
➢ An incorrect algorithm might not halt at all on some input instances, or it might halt with an
incorrect answer.
➢ Contrary to what you might expect, incorrect algorithms can sometimes be useful, if we can
control their error rate.
➢ Computer A:
➢ Computer B:
⮩ For many problems, such as sorting or computing discrete Fourier transforms, the most natural measure is
the number of items in the input—for example, the array size n for sorting.
⮩ For many other problems, such as multiplying two integers, the best measure of input size is the total
number of bits needed to represent the input in ordinary binary notation.
⮩ Sometimes, it is more appropriate to describe the size of the input with two numbers rather than one.
⮩ For instance, if the input to an algorithm is a graph, the input size can be described by the numbers of vertices and
edges in the graph.
⮩ We shall indicate which input size measure is being used with each problem we study.
➢ The code requires 3 units of space for the parameters and 1 unit for the local variable.
➢ Running time of an algorithm with respect to the problem instances of different sizes, is often
considered to be the decisive measure in differentiating between average algorithms and the
optimal one.
➢ Thus, analysing the time complexity of an algorithm is more important than analysing the
space complexity.