# Notes 5 - Week 5 Timing The Efficiency of Algorithms This...

This preview shows pages 1–3. Sign up to view the full content.

Week 5: Timing The Efficiency of Algorithms This may be the most important chapter in the course. The mathematical abilities of students who take this class at the University level differs from a typical Community College student. The material in the chapter that is beyond the mathematical abilities required as a prerequisite for this course will be skipped. This is especially true of the related material on recursion, which will be skipped in the next chapter also. As an introduction to efficiency, review the following four considerations: 1. Writing Time: very rarely considered, unless there is a dead line, then the algorithm that can be implemented fastest is best. 2. Storage: Not a typical consideration as memory is cheaper to upgrade than the cost to program tricks but embedded devices often have memory limitations, where the algorithm taking less memory is best. 3. Maintenance: The typical consideration taught in prior programming classes, where the algorithm that is clearest and most easy to modify is the best. 4. Execution time: The algorithm that runs the fastest is best. The purpose of this chapter is to develop measures to evaluate the best algorithm based on the execution time . Two Methods can be used to compare algorithms: 1. Statistics with random inputs (empirical) 2. Growth function (running time function) The focus of this course is on the growth function. However, there is always the alternative that any algorithm's timing be actually measured with a clock. This can be done no matter how difficult the mathematics may be. If necessary these time statistics can be compared. Even a simple Algorithm can be inefficient. An example in the text uses repeated additions instead of multiplying: 7562 * 423 = (3 ones) 7562 + 7562 + 7562 + (2 tens) 75620 + 75620 + (4 hundreds) 756200 + 756200 + 756200 + 756200 Task 1: Review sections 9.1 - 9.5 Running Time (Timing) Function: a measure of growth of the execution time as a function of n = size of the problem data, number of inputs, data set Notation: T(n) A. Inefficient algorithms are not big problems with small data sets. B. We compare (assume) the worst case, occasionally the average case and rarely the best case.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Task 2: See algorithms A, B, and C on Figure 9-1 then review 9-2 on page 248. We are about to make estimates for the timing of algorithms. Estimates are at the accuracy level of "order of magnitude" meaning powers of 10. (i.e. 10's, 100's 1000's etc. so that 20 and 14 have the same order of magnitude, so do 1234 and 3003) Appreciation of estimation 1. The highest paid professional that I know, more than doctors and lawyers, is an actuary, whose job is to estimate. 2. The final exam for Harvard freshman science classes includes an estimation
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 6

Notes 5 - Week 5 Timing The Efficiency of Algorithms This...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online