# Design and Analysis of Algorithms - PowerPoint PPT Presentation

PPT – Design and Analysis of Algorithms PowerPoint presentation | free to download - id: 61aa01-MWI2O

The Adobe Flash plugin is needed to view this content

Get the plugin now

View by Category
Title:

## Design and Analysis of Algorithms

Description:

### Design and Analysis of Algorithms Dr. Ameer Ali What is Algorithm? Algorithm has come to refer: a method that can be used by a computer for the solution of a problem. – PowerPoint PPT presentation

Number of Views:217
Avg rating:3.0/5.0
Slides: 16
Provided by: MAS110
Category:
Tags:
Transcript and Presenter's Notes

Title: Design and Analysis of Algorithms

1
Design and Analysis of Algorithms
• Dr. Ameer Ali

2
What is Algorithm?
• Algorithm has come to refer a method that can be
used by a computer for the solution of a problem.
• Definition An algorithm is a finite set of
instructions that, if followed, accomplishes a

3
What is Algorithm?
• Criteria
• Input Zero or more input
• Output At least one output
• Completeness Must be complete within time frame
• Definiteness Each instruction is clear and
unambiguous
• Finiteness Finite number of steps
• Effectiveness Very basic, feasible.

4
Why Algorithm?
• Developing reasoning
• Way to solve a real world problem
• Effective and efficient implementation in
computer language
• Efficient algorithm designing

5
Application Algorithm
• In all type of computer software as well as in
some hardware such as ROM.

6
Books
• Introduction to Algorithms Thomas H. Cormen
• Fundamentals of Computer Algorithms S. Sahni
• Algorithm Design Michael T. Goodrich
• The Art of Computer Programming Donald E. Knuth

7
Overview
• Introduction to Algorithm
• Elementary Data Structures
• Sorting
• Divide and Conquer
• Greedy Method
• Dynamic Programming
• Elementary Graph Algorithms

8
Overview
• Minimum Spanning Tree
• Single Source Shortest Path
• All Pair Shortest Path
• Maximum Flow
• Sorting Networks
• Computational Geometry
• NP-Completeness
• Some Research Papers

9
Example
• INSERT-SORT (A)
• For j2 to lengthA do
• keyAj
• ij-1
• while igt0 and Aigtkey do
• Ai1Ai
• ii-1
• Ai1key

10
Example
• A5,2,4,6,1,3
• 5, 2, 4, 6, 1, 3
• 2, 5 4 6 1 3
• 2 4 5 6 1 3
• 2 4 5 6 1 3
• 1 2 4 5 6 3
• 1 2 3 4 5 6

11
Analyzing Algorithms
• Space
• Time

12
Analyzing Insertion Sort
INSERT-SORT (A) For j2 to lengthA do keyAj /comments ij-1 while igt0 and Aigtkey do Ai1Ai ii-1 Ai1key Cost C1 C2 C4 C5 C6 C7 C8 Times n n-1 n-1 n-1 ?nj2tj ?nj2 (tj-1) ?nj2 (tj-1) n-1
13
Analyzing Insertion Sort
• T(n)c1nc2(n-1)c4(n-1)c5(?nj2tj)c6(?nj2
(tj-1))c7(?nj2 (tj-1))c8(n-1)
• For best case already sorted list
• T(n)c1nc2(n-1)c4(n-1)c5(n-1)c8(n-1)
• (c1c2c4c5c8)n-(c2c4c5c8)

14
Analyzing Insertion Sort
• For worst case sorted in reverse order here tjj
• ?nj2 j(n(n-1)/2) 1
• ?nj2 (j-1)n(n-1)/2
• T(n)(c5/2c6/2c7/2)n2 (c1c2c4c5/2-c6/2-c7/2
c8)n- (c2c4c5c8)