1 / 42

Chapter 13 Analysis of Algorithms

Chapter 13 Analysis of Algorithms. Analysis of Algorithms. multiple algorithms for same problem time-space tradeoff same algorithm on various computers how to compare complexity analysis. Asymptotic Complexity. comparison independent of actual data and machine used problem size

eliora
Télécharger la présentation

Chapter 13 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. Chapter 13Analysis of Algorithms

  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 such 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 program • to compare implementations or hardware • data? • representative set • System.currentTimeMillis • timing • example – methods of different order • results • accuracy of results

  7. Software Development

  8. Software Development • Phases • Analysis • problem statement • requirements specification • system analysts • inputs and outputs • system model • Design • class specifications • architectural plan • system designers • Coding • coding according to specifications • programmers

  9. Phases ofSoftware Development

  10. Testing • unit level testing • integration testing • system testing • testers • Debugging • based on test results • Production • trainers • technical support • Maintenance • releases • versions • Documentation • user documentation • technical documentation • technical writers

  11. Case Study: Grade Report System • Problem statement • Analysis • develop requirements specification • refine statement • determine inputs and outputs • files • Graphical User Interface (GUI) • report formats • develop model • select object/classes • determine relationships

  12. Problem Statement

  13. Analysis • Refinement • marking scheme? • Inputs • course name • bases and weights for each piece of work • number of students • for each student: • student #, name and mark for each piece of work • class list • text file with class (student) information • mark data arrives over time • requires persistence • binary file • application to create a new course • application to enter/update mark data

  14. Refined Problem Statement

  15. Outputs • forms • course info • marking scheme info • student info • reports • final mark report • for each student • student number and final grade • summary statistics: course average • others?

  16. Course Display Form

  17. Marking Scheme Display Form

  18. Student Display Form

  19. Grade Report Format

  20. Object/Classes • nouns in problem specification • candidate objects • eliminate values, duplicates and irrelevant entities • Model • relationships between classes • multiplicity

  21. Selecting Candidate Objects

  22. Candidate Objects and Identified Objects

  23. Analysis Model

  24. Design • Classes identified in analysis • Goal: detailed class descriptions • CRC card • class • responsibilities • collaborators • four cards, one per class • do responsibilities for knowing first • then responsibilities for doing • fill in collaborators

  25. CRC card

  26. Responsibilities for Knowing • Nouns in problem statement • keep values • others from analysis/experience • Assign each to a class • consider real-world • don’t duplicate in another class • Example: • student number and marks in Student • bases and weights in MarkingScheme • average final mark in Course

  27. Selecting Values

  28. Identified Fields (Values)

  29. Course

  30. MarkingScheme

  31. Student

  32. Work

More Related