Вы находитесь на странице: 1из 26

Lec‐01

Analysis of Algorithms 

Umar Manzoor
1
Course Title: Analysis of Algorithms (Sec A & 
B)
Prerequisite: Data Structures, Operating 
System

Yahoo Group:
http://groups.yahoo.com/group/analysisofalgo/
Name: Umar Manzoor
Email: umar.manzoor@nu.edu.pk
Office: N‐111‐A
Telephone Extension: 205
Office Hours:
Tuesday 12.30 – 2.00
Wednesday 12.30 – 2.00 
ƒ Never miss a class
ƒ Start working on projects/assignments from 
first day.
ƒ Come prepared in the class
ƒ Read book (s)
ƒ Remain attentive during the class
ƒ Remain interactive and show Class 
Participation
ƒ All people involved in any kind of cheating in 
any exam will get zero in that exam

ƒ Habitual cheaters will get zero in all 
assignments/projects. This may lead to a 
course failure.

ƒ Cheating punishment may become more 
strict
ƒ There will be 4‐5 programming assignments, 
related to the topics being studied in course 

ƒ Will require reasonable amount of 
programming effort 

ƒ Also carry decent weight. 

7
ƒ A project will be assigned to each group 
ƒ This involves studying a particular problem, 
analyzing its solution, implementing solution, 
running simulations and inferring results,
ƒ Also required is in depth complexity analysis of 
solution used.
ƒ A list of topic will be given in probably second week.

8
• Introduction  to  Algorithms,  by  Cormen, 
Leiserson and Rivest. Pub MIT Press 1990
• Get the latest edition if possible

• Another book for reference
• Data Structures and Algorithms, by Aho, Hopcroft
and Ullman, Pub Addision Wesley, 1983

9
Sessional exams 25%
Final exam 40%

Semester Project 20%


Quizzes 10%
Programming Assignments 15%

10
Lets start the course!

11
ƒ What are algorithms?
ƒ Why is the study of algorithms worthwhile?
ƒ What is the role of algorithms relative to 
other technologies used in computers?

12
ƒ 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.

ƒ So it is a sequence of computational steps that 
transform the input into the output.

ƒ A tool for solving a well‐specified computational 
problem.
13
ƒ Input: A sequence of n numbers 
<a1,a2,a3…an>
ƒ Output: A permutation (re‐ordering) 
<b1,b2,b3…bn> of the input sequence such 
that b1<b2<b3…<bn

14
ƒ An algorithm is said to be correct if , for every 
input instance, it halts with the correct 
output.
ƒ An incorrect algorithm 
ƒ might not halt at all on some input instances, or
ƒ It might halt with an answer other than desired 
one.
ƒ Can incorrect algorithm be useful?

15
ƒ Sorting/searching are by no mean the only 
computational problem for which algorithms 
have been developed.
ƒ Otherwise we wouldn’t have the whole 
course on this topic
ƒ Practical application of algorithms are 
ubiquitous and include the following 
examples

16
ƒ The human Genome project
ƒ Internet world
ƒ Electronic commerce 
ƒ Manufacturing and other commercial 
settings
ƒ Shortest path
ƒ Matrices multiplication order
ƒ DNA sequence matching

17
ƒ There are many candidate solution, most of 
which are not what we want, finding one that 
we do want can present quite a challenge.

ƒ There are practical applications (its not just 
mathematical exercises to develop 
algorithms.)

18
ƒ The theoretical study of computer‐program 
performance and resource usage.
ƒ What’s more important than performance?
• Modularity
• Correctness
• Maintainability
• Functionality
• Robustness
• User‐friendliness
• Programmer time
• Simplicity
• Extensibility
• Reliability 19
ƒ Algorithms help us to understand scalability.
ƒ Performance often draws the line between 
what  is feasible and what is impossible.
ƒ Algorithmic mathematics provides a language 
for talking about program behavior.
ƒ Performance is the currency of computing.
ƒ The lessons of program performance 
generalize  to other computing resources. 
ƒ Speed is fun!
20
ƒ A data structure is a way to store and 
organize data in order to facilitate access and 
modifications.
ƒ No single data structure works well for all 
purposes
ƒ Need to know the strengths and limitations 
of several of them.

21
ƒ Cant get a “cookbook” for algorithms?
ƒ Many problems you will encounter don’t have any 
published algorithm.
ƒ So need to learn “techniques” of algorithms design 
and analysis
ƒ So you develop algorithms in your own, show that 
they give correct answer and understand their 
efficiency. 
ƒ We will learn several such techniques in later part of 
this course.

22
ƒ Is an algorithm a technology like hardware, 
etc?
ƒ Total system performance depends on 
choosing “efficient” algorithms as much as 
choosing fast hardware.

23
ƒ Hardware with high clock rates, pipelining and 
superscalar architecture.
ƒ Easy to use, intuitive graphical user interface 
(GUI’s)
ƒ Object oriented systems.
ƒ Local‐area and wide‐area networking.

ƒ Are algorithms as important as above 
technologies?

24
ƒ Algorithms are at the core of most technologies 
used in contemporary computers
ƒ Efficient algorithm can be used to solve larger 
problems than ever before.

25
ƒ Program Efficiency and Complexity Analysis.
ƒ CHP‐2,3 Cormen.
ƒ A quick review!
ƒ Come prepared with lectures from DS course 

26

Вам также может понравиться