You are on page 1of 26

Advance Analysis of

Algorithms
Course Information Reference Books Other
Books
• Approximation Algorithms by Vijay V. Vazirni, Springer, 2004.
• Introduction to Algorithms by Thomas H. Cormen, Charles E. Leiserson, Ronald L.
Rivest, Clifford Stein, 2nd edition, published by MIT Press, 2001
• Algorithms and Theory of Computation Handbook, by Mikhail J. Atallah
Contributor Mikhail J. Atallah, CRC Press, 1998.
• Other Books
• Introduction to Design & Analysis Computer Algorithm 3rd, Sara Baase, Allen Van
Geleder, Adisor-Wesley 2000.
• Algorithms, Richard Johnsonbaugh, Marcus Schaefer, Prentice Hall, 2004
• Introduction to The Design and Analysis of Algorithms 2nd Edition Anany Levitin,
Adison-Wesley, 2007.
Course Information Supporting Material
Class Assessment Tools
• Lecture Slides & Notes
• Research Articles
• Class Assessment Tools
• Assignments
• Presentations
• Research Articles Reading
• Research Paper Writing
Course Information Course Objective
• Design and Analysis of Modern Algorithms
• Different variants
• Efficiency
• Accuracy
• Comparing Efficiencies
• Motivation Thinking New Algorithms
• Advanced Designing Techniques
• Real World Research Problems will be taken as example.
• Major focus of the subject is to Study Algorithms in Research Perspective.
Course Information Expected Results
• On successful completion of this courses, students will be able to
• Understand, analyze algorithms
• Argue and prove correctness of algorithms
• Analyze Time and Space Complexity of Algorithms
• Understand algorithm design approaches
• Use of graph theory in Problem Solving
• Understand advance analysis and design topics.
• Easily analyze existing algorithms and able to propose more efficient
and effective algorithm for any real life research problem / situation.
Course Objectives
• This course introduces students to the analysis and design of
computer algorithms. Upon completion of this course, students will
be able to do the following:
• Analyze the asymptotic performance of algorithms.
• Demonstrate a familiarity with major algorithms and data structures.
• Apply important algorithmic design paradigms and methods of
analysis.
• Synthesize efficient algorithms in common engineering design
situations.
Course Outline
• Preliminaries : different types of algorithms, analyzing methodologies,
• notations, proof techniques and limits.
• Asymptotic Notation : different notations and their examples, standard
• notations and their common functions.
• Analysis of Algorithms : analyzing control structures, using barometer
• instruction, amortization, and different examples for analysis and solving
• recurrences.
• Structures: use of arrays, stacks, queues, records, pointers, lists, graphs,
• trees, hash tables, heaps and binomial heaps.
• Searching/Sorting Algorithms : Various searching and sorting algorithms and
• their comparisons.
Algorithm Informal Definition
Algorithm Definition
• A computer algorithm is a detailed step-by-
step method for solving a problem by using a
computer.
• An algorithm is a sequence of unambiguous
instructions for solving a problem in a finite
amount of time.
• An Algorithm is well defined computational
procedure that takes some value, or set of
values, as input and produces some value, or
set of values as output.
• More generally, an Algorithm is any well
defined computational procedure that takes
collection of elements as input and produces
a collection of elements as output.
Popular Algorithms, Factors of Dependence
• Most basic and popular algorithms are
• Sorting algorithms
• Searching algorithms
• Which algorithm is best?
• Mainly, it depends upon various factors, for example in case of sorting
• The number of items to be sorted
• The extent to which the items are already sorted
• Possible restrictions on the item values
• The kind of storage device to be used etc.
• Dr Nazir A. Zafar Advanced Algorithms Analysis and Design
One Problem, Many Algorithms
• The statement of the problem specifies, in general terms, the desired
input/output relationship.
• Algorithm
• The algorithm describes a specific computational procedure for achieving
input/output relationship.
• Example
• One might need to sort a sequence of numbers into non-decreasing order.
• Algorithms
• Various algorithms e.g. merge sort, quick sort, heap sorts etc.
ANALYSIS OF ALGORITHMS
• How good is the algorithm?
• Correctness
• Time efficiency
• Space efficiency
• Simplicity
• Generality
• Does there exist a better algorithm?
• Lower bounds
• Optimality
Algorithm Concepts What is Data Structure?
• A data structure is a systematic way of organizing and accessing data. Some basic
data structure as follows.
•  Array
•  Link List
•  Stacks
•  Queues
•  Trees
• What is Program?
• Program is an implementation of an algorithm in some programming language.
• Data structure + Algorithm = Program
Design & Analysis of Algorithms
• The “design” pertains to
• i. The description of algorithm at an abstract level by means of a
pseudo language, and
• ii. Proof of correctness that is, the algorithm solves the given problem
in all cases.
• 2. The “analysis” deals with performance evaluation (complexity
analysis).
Problem, Solution and Tools
• A computer does not solve problems; it's just a tool that I can use to implement my plan for
solving the problem.
• A computer program is a set of instructions for a computer. These instructions describe the
steps that the computer must follow to implement a plan.
• An algorithm is a plan for solving a problem.
• A person must design an algorithm.
• A person must translate an algorithm into a computer program.
• Algorithm Development Process
• Understand the problem
• Design an algorithm and proper data structures
• Analyze the algorithm
• Code the algorithm
What is a good algorithm?
• Good algorithm is an efficient algorithm.
• What does efficient means?
• Efficient is something, which has small running time and takes (spaced
used) less memory.
•  We would be spending more time on analyzing the running time of
an algorithm.
•  We will also spend some time on analyzing the space. Efficiency of
algorithms is as a function of input size.
How to Calculate Running Time
• analyze running time in the
• best case (usually useless)
• worst case (we focus on the worst case running time)
• average case (very useful but often difficult to determine)
Theoretical Analysis of Running Time
• Uses a pseudo-code description of the algorithm instead of an
implementation
• Characterizes running time as a function of the input size, n
• Takes into account all possible inputs
• Allows us to evaluate the speed of an algorithm independent of the
hardware/software environment
Pseudocode Example: find max element of an
array
• In this course, we will mostly use pseudocode to describe an algorithm
• Pseudocode is a high- level description of an algorithm
• More structured than English prose
• Less detailed than a program
• Preferred notation for describing algorithms
• Hides program design issues
• Algorithm arrayMax(A, n)
• Input: array A of n integers
• Output: maximum element of A
• currentMax  A[0]
• for i  1 to n  1 do
• if A[i]  currentMax then
• currentMax  A[i]
• return currentMax
Pseudocode Details Algorithm arrayMax(A,
n)
• Input: array A of n integers
• Output: maximum element of A
• currentMax  A[0]
• for i  1 to n  1 do
• if A[i]  currentMax then
• currentMax  A[i]
• return currentMax
• Control flow
• if … then … [else …]
• while … do …
• repeat … until …
• for … do …
• Method declaration
• Algorithm method (arg, arg…)
• Input …
• Output …
Primitive Operations
• For theoretical analysis, we will count primitive or basic operations,
which are simple computations performed by an algorithm
• Basic operations are:
• Identifiable in pseudocode
• Largely independent from the programming language
• Exact definition not important (we will see why later)
• Assumed to take a constant amount of time
Primitive Operations Examples of primitive
operations:
• Evaluating an expression x2+ey
• Assigning a value to a variable cnt  cnt+1
• Indexing into an array A[5]
• Calling a method mySort(A,n)
• Returning from a method return(cnt)
Real-World Applications
• Hardware design: VLSI chips
• Compilers
• Computer graphics: movies, video games
• Routing messages in the Internet
• Searching the Web
• Distributed file sharing
• Computer aided design and manufacturing
• Security: e-commerce, voting machines
• Multimedia: CD player, DVD, MP3, JPG, HDTV
• DNA sequencing, protein folding
• and many more!
Some Important Problem Types
• Sorting a set of items
• Searching among a set of items
• String processing text, bit strings, gene sequences
• Graphs model objects and their relationships
• Combinatorial
• find desired permutation, combination or subset
• Numerical
• continuous math: solving equations, evaluating functions
Algorithm Design Techniques
• Brute Force & Exhaustive Search
• Divide & Conquer (break problem into distinct subproblems)
• Transformation (convert problem to another one)
• Dynamic Programming (break problem into overlapping subproblems)
• Greedy (repeatedly do what is best now)
• Iterative Improvement (repeatedly improve current solution)
• Randomization (use random numbers)
Thanx for Listening

You might also like