Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
0Activity
0 of .
Results for:
No results containing your search query
P. 1
03 Measuring Runtime and Pseudocode

03 Measuring Runtime and Pseudocode

Ratings: (0)|Views: 8|Likes:
Published by Chengwei Dai
Algorithm
Algorithm

More info:

Published by: Chengwei Dai on Jun 15, 2014
Copyright:Traditional Copyright: All rights reserved

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

06/15/2014

pdf

text

original

 
Lecture 3:Measuring Runtime, andPseudocode
EECS 281: Data Structures & Algorithms
 
Complexity Recap
Notation and terminology
 –
n
= input Size
 –
f(n)
= max number of steps when input has length
n
 –
O(f(n))
asymptotic upper bound
void f(int*out, constint*in, intsize) {intproduct = 1;for (inti=0; i<size; ++i)product *= in[i];for(inti=0; i<size; ++i)out[i] = product / in[i];}
f(n) = 1 + 1 + 1 + 3n + 1+ 3n
f(n) = O(n)
 
Ways to measure complexity
We now know how to model complexity mathematically
Today, we will measure it empirically

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->