Analysis and Design of Algorithms <ul><li>An algorithm is a method of solving problem (on a computer) </li></ul><ul><li>Pr...
Combinatorial Problems <ul><li>Closest pair </li></ul><ul><ul><li>O(n^2) algorithm </li></ul></ul><ul><li>TSP </li></ul><u...
Course Overview <ul><li>General algorithmic methods </li></ul><ul><ul><li>divide and conquer, greedy algorithms, dynamic p...
Grading <ul><li>Home work  1/3 </li></ul><ul><ul><li>problems from Cormen ...  </li></ul></ul><ul><ul><li>two programming ...
Home Work  <ul><li>Problem sets </li></ul><ul><ul><li>weekly </li></ul></ul><ul><ul><li>handed in/out Tuesdays (usually) <...
Sorting <ul><li>Input: sequence of numbers  </li></ul><ul><li>Output: a sorted sequence  </li></ul><ul><li>Insertion-Sort ...
How it works <ul><li>Insertion-Sort </li></ul><ul><ul><li>for j = 2 to n do </li></ul></ul><ul><ul><ul><li>current = A[j] ...
Running Time <ul><li>Depends on </li></ul><ul><ul><li>input size  </li></ul></ul><ul><ul><li>input quality (partially orde...
Asymptotic Analysis <ul><li>Ignore machine dependent constants </li></ul><ul><li>Look at growth of T(n) while n      </l...
Insertion Sort Analysis <ul><li>Worst Case  O (n^2) </li></ul><ul><li>Average Case  O (n^2) </li></ul><ul><li>Can we do be...
Upcoming SlideShare
Loading in …5
×

Lect01

418 views

Published on

daa slide lecturer 01

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
418
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Lect01

  1. 1. Analysis and Design of Algorithms <ul><li>An algorithm is a method of solving problem (on a computer) </li></ul><ul><li>Problem example: </li></ul><ul><ul><li>given a set of points on the plane </li></ul></ul><ul><ul><li>find the closest pair </li></ul></ul><ul><li>Algorithm: </li></ul><ul><ul><li>find distance between all pairs </li></ul></ul><ul><li>Can we do it faster? </li></ul>
  2. 2. Combinatorial Problems <ul><li>Closest pair </li></ul><ul><ul><li>O(n^2) algorithm </li></ul></ul><ul><li>TSP </li></ul><ul><ul><li>O(n!) algorithm </li></ul></ul><ul><ul><li>too slow </li></ul></ul><ul><ul><li>difficult problem </li></ul></ul>
  3. 3. Course Overview <ul><li>General algorithmic methods </li></ul><ul><ul><li>divide and conquer, greedy algorithms, dynamic programming </li></ul></ul><ul><li>Data structures </li></ul><ul><ul><li>hashing, priority queues, binary search trees, binomial heaps </li></ul></ul><ul><li>Combinatorial problems </li></ul><ul><ul><li>MST, TSP, Vertex/Set Cover, Matrix </li></ul></ul><ul><li>Computational Complexity </li></ul><ul><ul><li>NP-completeness, reducibility, approximation </li></ul></ul><ul><li>Cormen-Leiserson-Rivest </li></ul><ul><li>Introduction to Algorithms </li></ul>
  4. 4. Grading <ul><li>Home work 1/3 </li></ul><ul><ul><li>problems from Cormen ... </li></ul></ul><ul><ul><li>two programming assignments </li></ul></ul><ul><li>4 Quizes 1/3 </li></ul><ul><li>4520 Final 1/3 </li></ul><ul><li>6520 Project 1/3 </li></ul>
  5. 5. Home Work <ul><li>Problem sets </li></ul><ul><ul><li>weekly </li></ul></ul><ul><ul><li>handed in/out Tuesdays (usually) </li></ul></ul><ul><ul><li>Extra-credit problems! </li></ul></ul><ul><li>Due next Tuesday </li></ul><ul><ul><li>1.4-1 p.17 / 1.2-2 p.13 </li></ul></ul><ul><ul><li>1.4-2 p.17 / 1.2-2 p.13 </li></ul></ul>
  6. 6. Sorting <ul><li>Input: sequence of numbers </li></ul><ul><li>Output: a sorted sequence </li></ul><ul><li>Insertion-Sort </li></ul><ul><ul><li>for j = 2 to n do </li></ul></ul><ul><ul><ul><li>current=A[j] </li></ul></ul></ul><ul><ul><ul><li>i = j - 1 </li></ul></ul></ul><ul><ul><ul><li>while i > 0 & A[i] > current do </li></ul></ul></ul><ul><ul><ul><ul><li>A[i + 1] = A[i] </li></ul></ul></ul></ul><ul><ul><ul><ul><li>i = i - 1 </li></ul></ul></ul></ul><ul><ul><ul><li>A[i + 1] = current </li></ul></ul></ul>
  7. 7. How it works <ul><li>Insertion-Sort </li></ul><ul><ul><li>for j = 2 to n do </li></ul></ul><ul><ul><ul><li>current = A[j] next current </li></ul></ul></ul><ul><ul><ul><li>i = j - 1 go left </li></ul></ul></ul><ul><ul><ul><li>while i > 0 A[i] & A[i] > current do find place for current </li></ul></ul></ul><ul><ul><ul><ul><li>A[i + 1] = A[i] shift sorted right </li></ul></ul></ul></ul><ul><ul><ul><ul><li>i = i - 1 go left </li></ul></ul></ul></ul><ul><ul><ul><li>A[i + 1] = current put current in place </li></ul></ul></ul>
  8. 8. Running Time <ul><li>Depends on </li></ul><ul><ul><li>input size </li></ul></ul><ul><ul><li>input quality (partially ordered) </li></ul></ul><ul><li>Kinds of analysis </li></ul><ul><ul><li>Worst case (standard) </li></ul></ul><ul><ul><li>Average case (sometimes) </li></ul></ul><ul><ul><li>Best case (never) </li></ul></ul>
  9. 9. Asymptotic Analysis <ul><li>Ignore machine dependent constants </li></ul><ul><li>Look at growth of T(n) while n   </li></ul><ul><li>O - notation </li></ul><ul><li>O(n^3)>O(n^2) </li></ul>
  10. 10. Insertion Sort Analysis <ul><li>Worst Case O (n^2) </li></ul><ul><li>Average Case O (n^2) </li></ul><ul><li>Can we do better? </li></ul><ul><li>New paradigms </li></ul>

×