lec06 - CSE 12 Algorithm Time Cost Measurement Analysis vs....

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
06-1/19 Analysis vs. measurement Timing an algorithm Average and standard deviation Improving measurement accuracy CSE 12 Algorithm Time Cost Measurement
Background image of page 1

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

View Full DocumentRight Arrow Icon
06-2/19 Introduction Three characteristics of programs are of interest to us: robustness : a program’s ability to spot exceptional conditions and deal with them or shutdown gracefully correctness : does the program do what it is “supposed to”? efficiency : all programs use resources (time and space, i.e. CPU cycles and memory); how can we measure efficiency so that we can compare algorithms?
Background image of page 2
06-3/19 Analysis and Measurement An algorithm’s performance can be described by: time complexity or cost – how long it takes to execute. In general, less time is better! space complexity or cost – how much computer memory it uses. In general, less space is better! Time and space costs are usually given as functions of the size of the input to the algorithm A big problem will take more time and space to solve than a small one, but how much more?
Background image of page 3

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

View Full DocumentRight Arrow Icon
06-4/19 Figuring algorithm costs For a given algorithm, if the size of the input is n , we would like to know: T( n ) , the time cost of solving the problem S( n ) , the space cost of solving the problem We can analyze the written algorithm Or we could implement the algorithm and run it and measure the time and memory usage
Background image of page 4
06-5/19 Algorithm analysis vs. measurement Asymptotic analysis (just counting statements executed, and putting the result in terms of big-O, big- omega, or big-theta notation) is elegant, and it's important to know how to do it. .. but it doesn’t tell the full story. For example: in terms of asymptotic analysis of time cost, finding the largest value in an array of int s and an array of Integer objects is the same, but in reality… So sometimes you should consider algorithm measurement , also known as benchmarking
Background image of page 5

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

View Full DocumentRight Arrow Icon
06-6/19 Algorithm Measurement The basic idea is simple: Implement the algorithm
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 06/15/2011 for the course ECON 1 taught by Professor Aben during the Fall '07 term at City College of San Francisco.

Page1 / 19

lec06 - CSE 12 Algorithm Time Cost Measurement Analysis vs....

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online