Lec 1
Lec 1
algorithms
Introduction to DAA
Lecture 1
Why we need to study this subject?
Textbook
Introduction to Algorithms 3rd , Thomas H.
Corman, Charles E. Leiserson, Ronald L. Rivest
and Clifford Stein
Algorithms, (4th edition, 2011), Robert Sedgewick, Kevin Wayne
Algorithm Design, (1st edition, 2013/2014)
Jon Kleinberg, Eva Tardos.
Outline
Design and analysis of algorithm
Problem
Algorithm
+ Data structure
Program
The word algorithm comes from name of Persian author “Abu Jaffar Mohammad” in
825AD.
Def
An algorithm is a sequence of computational steps that transform the input into the output.
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.
Another def.
Finite set of steps to solve a problem.
Fundamentals for algorithm
Combination of natural language and programming language construct For e.g.to perform
addition of two numbers we write in pseudo-code
//this algo perform addition of two integers
//input two integers a and b
// output of two integers
C=a+b
Write c
Flow Chart
What is a program?
2.space complexity:
Space complexity means the amount of space required by an algorithm to run.It expressed as an order of
magnitude.There are two important factors to compute the space complexity:constant and instant
characterstic.
e.g
factorial(n)
if n=0 then
return 1;
else
return*factorial(n-1);
endif
space complexity of program = constant size + variable size