Lecture 01
Lecture 01
Lecture 1
Textbook
Introduction to Algorithms 2nd ,Cormen,
Leiserson, Rivest and Stein, The MIT Press, 2004.
o
Data Structures and Algorithm Analysis
Others
Introduction to Design & Analysis Computer Algorithm 3rd,
Sara Baase, Allen Van Gelder, Adison-Wesley, 2000.
Algorithms, Richard Johnsonbaugh, Marcus Schaefer, Prentice
Hall, 2004.
Introduction to The Design and Analysis of Algorithms 2 nd
Edition, Anany Levitin, Adison-Wesley, 2007.
Others
1.R. Neapolitan, Foundations of Algorithms, 5/e, Jones and Bartlett Learning,
2014.
2.Robert Sedgewick, Kevin Wayne, Algorithms, 4/e, Addison-Wesley Professional,
2011.
M H Alsuwaiyel, Algorithms: Design Techniques and Analysis, World
Scientific Pub Co Inc, Year: 2021.
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.
is thus a sequence of computational steps that
transform the input into the output.
is a tool for solving a well - specified
computational problem.
Any special method of solving a certain kind of p
roblem (Webster Dictionary)
Analysis of Algorithm Sunday, July 14, 2024 10
Algorithm
Correctness
Does the input/output relation match algorithm r
equirement?
Amount of work done (aka complexity)
Basic operations to do task finite amount of time
Amount of space used
Memory used
Important Features:
Finiteness.[algo should end in finite amount of
steps]
Definiteness.[each instruction should be clear]
Input.[valid input clearly specified ]
Output.[single/multiple valid output]
Effectiveness.[ steps are sufficiently simple and
basic]
English
American
A la russe
Running Time
80
with the input size.
Average case time is often 60
difficult to determine. 40
running time. 0
1000 2000 3000 4000
Easier to analyze
Input Size
Crucial to applications such as
games, finance and robotics
Time (ms)
composition 5000
Use a method like 4000
System.currentTimeMillis() to 3000
get an accurate measure 2000
of the actual running time
1000
Plot the results
0
0 50 100
Input Size
Algorithm arrayMax(A, n)
currentMax A[0]
for (i =1; i<n; i++) n
(i=1 once, i<n n times, i++ (n-1)
times:post increment)
if A[i] currentMax then (n 1)
currentMax A[i] (n 1)
return currentMax
Total 3n