1 / 7

Analysis of Algorithms

Analysis of Algorithms. Only Adam had no mother-in-law. That's how we know he lived in paradise. Analysis of Algorithms. multiple algorithms for same problem time-space tradeoff same algorithm on various computers how to compare complexity analysis. Asymptotic Complexity.

marlon
Télécharger la présentation

Analysis 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 of Algorithms Only Adam had no mother-in-law. That's how we know he lived in paradise.

  2. Analysis of Algorithms • multiple algorithms for same problem • time-space tradeoff • same algorithm on various computers • how to compare • complexity analysis

  3. Asymptotic Complexity • comparison independent of actual data and machine used • problem size • significant step • time complexity in terms of problem size • e.g. g(n) = n2/2 + 5n/2 - 3 • compare functions • approximation of g(n) • asymptotic complexity • dominant term

  4. Methods • big-O notation • order O(…) • order of dominant term • definition • desire lowest order function • big-Ω notation • definition • if g(n) is O(f(n)) then f(n) is Ω(g(n)) • big-Θ notation • definition • if g(n) is Θ(f(n)) then g(n) is O(f(n)) and g(n) is Ω(f(n)) • comparison • complexity classes • polynomial • non-polynomial

  5. Determining Complexity • informal analysis • rough count of significant step • constant time (O(1)) • number of times independent of n • linear code • loops • if number of times is a factor of n • order is the order of the factor • nested code • nesting rule • sum of the orders • sequential code • sequence rule • maximum of the orders • examples

  6. Timing Algorithms • determining actual run-time of algorithm • data? • representative set • System.currentTimeMillis • timing • example – methods of different order • results • accuracy of results

  7. The End

More Related