1 / 10

Analysis and Design of Algorithms

Analysis and Design of Algorithms. An algorithm is a method of solving problem (on a computer) Problem example: given a set of points on the plane find the closest pair Algorithm: find distance between all pairs Can we do it faster?. Combinatorial Problems. Closest pair

jontae
Télécharger la présentation

Analysis and Design of Algorithms

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Analysis and Design of Algorithms • An algorithm is a method of solving problem (on a computer) • Problem example: • given a set of points on the plane • find the closest pair • Algorithm: • find distance between all pairs • Can we do it faster?

  2. Combinatorial Problems • Closest pair • O(n^2) algorithm • TSP • O(n!) algorithm • too slow • difficult problem

  3. Course Overview • General algorithmic methods • divide and conquer, greedy algorithms, dynamic programming • Data structures • hashing, priority queues, binary search trees, binomial heaps • Combinatorial problems • MST, TSP, Vertex/Set Cover, Matrix • Computational Complexity • NP-completeness, reducibility, approximation • Cormen-Leiserson-Rivest Introduction to Algorithms

  4. Grading • Home work 20% • Two programming assignments 5+5% • Midterm 30% • Final 40%

  5. Home Work • Problem sets • weekly • handed in/out Mondays • Due next Monday • 1.4-1 p.17 • 1.4-2 p.17

  6. Sorting • Input: sequence of numbers Output: a sorted sequence • Insertion-Sort for j=2 to n do current=A[j] I = j-1 while I>0 A[I] & A[I]>current do A[I+1]=A[I] I=I+1 A[I+1]=current

  7. How it works • Insertion-Sort for J=2 to n do current=A[J] next current I = j-1 go left while I>0 A[I] & A[I]>current do find place for current A[I+1]=A[I] shift sorted right I=I+1 go left A[I+1]=current put current in place

  8. Running Time • Depends on • input size • input quality (partially ordered) • Kinds of analysis • Worst case (standard) • Average case (sometimes) • Best case (never)

  9. Asymptotic Analysis • Ignore machine dependent constants • Look at growth of T(n) while n   • O - notation • O(n^3)>O(n^2)

  10. Insertion Sort Analysis • Worst Case O(n^2) • Average Case O(n^2) • Can we do better? • New paradigms

More Related