|
|
|
lecture 8.pdf
lecture_8.pdf
Showing 3-6 out of 6
lecture 8.pdf-EECS 203 Spring 2016 Lecture 8
lecture_8.pdf-EECS 203 Spring 2016 Lecture 8
lecture 8.pdf-EECS 203 Spring 2016 ...
lecture_8.pdf-EECS 203 Spring 2016 Lecture 8
Page 3
EECS 203 Spring 2016 Lecture 8
Page
3
of
6
Growth of Function (3.2)
As we saw above, In order to discuss the runtime complexity in a reasonable way, we need some way to
cleanly focus on the fundamentals of an algorithm, not the specifics of an implementation.
What the CS
community has largely settled on is a notation that shows us how an algorithm’s runtime relates to the
size of the input.
And in order to do that, we’re going to need some more notation and terminology!
Or put a bit more formally,
∃, ∀( > )
it is the case that
|() ≤ |()|
.
1.
For what values of C and k (if any) is it the case that x
2
=O(x
2
+4)?
2.
For what values of C and k (if any) is it the case that x
2
=O(100x+4)?
3.
For what values of C and k (if any) is it the case that x
2
=O(x
3
+4)?
4.
Is log(x)=O(x)?
5.
Is 2x
2
+x=O(x
2
)?
6.
Is x
2
=O(2x
2
+x)?
Page 4
EECS 203 Spring 2016 Lecture 8
Page
4
of
6
7.
Quickly
show that the sum of the integers from 1 to n is O(n
2
). (Do this without any previous
results about that sum…)
One cool result (and part of why big-O is so darn useful) is the following
1.
Give a big-O estimate of
() = ( + 1) log() +
2
2.
Give a big-O estimate of
() = (2
) + 100
4
+ log()
Page 5
EECS 203 Spring 2016 Lecture 8
Page
5
of
6
Big Theta and Big Omega
Basically if f(x)=O(g(x)) then g(x)=
(f(x)).
And if f(x) is both big-O of g(x)
and
big-Omega of g(x) it is also
“of the order of” g(x) and f(x)=
(g(x))
Algorithm complexity (3.3)
We will generally use the big-O notation to describe the runtimes of algorithms in terms of their inputs.
Provide a reasonable big-O estimate for the run time of the following algorithms:
Page 6
EECS 203 Spring 2016 Lecture 8
Page
6
of
6
There are a few other important things from section 3.3.
Terminology
It turns out people rarely say things like
(n).
Instead they will say “its runtime is linear” or some such.
Below is a list of terms you might hear when discussing complexity.
The ones with
next to them are terms you should know.
In addition you should be aware that
(n
2
) is often just referred to as “quadratic complexity”.
Tractability
In general, we want to run algorithms that can actually solve problems.
In section 3.2 the text showed
that there exist problems which cannot be solved. But we also may encounter problems that are
solvable, but aren’t able to be solved in a reasonable period of time over a reasonable input set (yes,
that was really vague on purpose).
As a pretty arbitrary line, CS folks have chosen to call anything that can’t be solved in polynomial time or
less “intractable” meaning that it may be solvable but we can’t really solve it in the general case.
Again,
this is pretty arbitrary.
While 2
n
certainly grows faster than n
100
, it is actually smaller for quite a long
time (~n=1000) and well past when we’d have a chance of doing the computation (at n=1000 both are
around 10E300).
That said, we rarely encounter polynomial complexity algorithms where the exponent is much greater
than 4 or 5.
While we do hit exponential algorithms on a regular basis.
The “P=NP” question asks if a certain class of important algorithms (including things like minesweeper!)
have a polynomial complexity or not.
That one is still out…
Ace your assessments! Get Better Grades
Browse thousands of Study Materials & Solutions from your Favorite Schools
University of Michigan-An...
University_of_Michigan-Ann_Arbor
School:
Discrete_Mathematics
Course:
Introducing Study Plan
Using AI Tools to Help you understand and remember your course concepts better and faster than any other resource.
Find the best videos to learn every concept in that course from Youtube and Tiktok without searching.
Save All Relavent Videos & Materials and access anytime and anywhere
Prepare Smart and Guarantee better grades
Students also viewed documents
lab 18.docx
lab_18.docx
Course
Course
3
Module5QuizSTA2023.d...
Module5QuizSTA2023.docx.docx
Course
Course
10
Week 7 Test Math302....
Week_7_Test_Math302.docx.docx
Course
Course
30
Chapter 1 Assigment ...
Chapter_1_Assigment_Questions.docx.docx
Course
Course
5
Week 4 tests.docx.do...
Week_4_tests.docx.docx
Course
Course
23
Week 6 tests.docx.do...
Week_6_tests.docx.docx
Course
Course
106