CSC165H1 Study Guide - Summer 2018, Comprehensive Midterm Notes - Texas State Highway Loop 1, White And Black In Chess, Wax
CSC165H1
MIDTERM EXAM
STUDY GUIDE
Fall 2018
CSC 165
Week 8.
Quick Review
Analyze the runtime of algorithms
Goal: given a program. Find an approximately # of step
In term of input size as the input gets large.
The answer is usually a expression
Input size: formula the # of bits required to represent the input informally, use approximately
- For a natural # its value
- For a list its length
Step: a lok of ode whose ontinues does’t depend on the input size
Examples:
1) Arithmetic
2) Compassion
3) Variable
Assignment
And lookup
1) Input
find more resources at oneclass.com
find more resources at oneclass.com
2) Function call and return
Ex. Find the asymptotic (theta) runtime of the following function
We can treat the entire body as a single step.
It does not depend on how large is !
The number of step is 1 (for all )
And 1
So the runtime is
How does runtime grows?
1) Loop! CSC 165!
2) Recursive function CSC 216
3) Pealing with impound
Data structure CSC 148. CSC 263
When given a loop do tusk thing
1) Identify # of iteration
2) Identify # of step per iteration
Ex.
steps
steps
find more resources at oneclass.com
find more resources at oneclass.com
cherryberry1035 and 38883 others unlocked
3
CSC165H1 Full Course Notes
Verified Note
3 documents
Document Summary
Quick review (cid:1859)(cid:1857)(cid:882)(cid:4666)(cid:1858)(cid:4667)"(cid:1859) (cid:1858)" (cid:1859)(cid:4666)(cid:1866)(cid:4667) (cid:1855)(cid:1858)(cid:4666)(cid:1866)(cid:4667) (cid:1859) (cid:4666)(cid:1858)(cid:4667)"(cid:1859) (cid:1858)" (cid:1859)(cid:4666)(cid:1866)(cid:4667) (cid:1855)(cid:1858)(cid:4666)(cid:1866)(cid:4667) (cid:1859) (cid:4666)(cid:1866)(cid:4667)(cid:4666)(cid:1858)(cid:4667)g=f (cid:1855)(cid:2869)(cid:1858)(cid:4666)(cid:1866)(cid:4667)=(cid:1859)(cid:4666)(cid:1866)(cid:4667)=(cid:1855)(cid:2870)(cid:1858)(cid:4666)(cid:1866)(cid:4667) (cid:1859) (cid:882)(cid:4666)(cid:1866)(cid:2869)(cid:2868)(cid:2868)(cid:2868)(cid:4667) (cid:1859) (cid:882)(cid:4666)(cid:1866)(cid:2869)(cid:2868)(cid:2868)(cid:2868)(cid:4667) (cid:1859) (cid:1866) (cid:1859) (cid:1866)(cid:2868). (cid:2873) (cid:1859)+(cid:883)(cid:882)(cid:1859)(cid:1866) In term of input size as the input gets large. Input size: formula the # of bits required to represent the input informally, use approximately. Step: a (cid:271)lo(cid:272)k of (cid:272)ode whose (cid:272)ontinues does"t depend on the input size. Examples: arithmetic +, , ,/,, compassion ,=, variable =(cid:887) And lookup: input, function call and return. Find the asymptotic (theta) runtime of the following function. We can treat the entire body as a single step. (cid:1856)(cid:1857)(cid:1858) (cid:1858)(cid:4666)(cid:1866):(cid:1861)(cid:1866)(cid:1872)(cid:4667) (cid:1861)(cid:1866)(cid:1872) It does not depend on how large (cid:1866) is ! The number of step is 1 (for all (cid:1866)) Csc 165: recursive function csc 216. When given a loop do tusk thing (cid:1866: identify # of iteration, identify # of step per iteration. Ex. (cid:1856)(cid:1857)(cid:1858):(cid:1858)(cid:2870)(cid:4666)(cid:1866)(cid:4667) (cid:1858)(cid:1867)(cid:1870) (cid:1861) (cid:1861)(cid:1866) (cid:1870)(cid:1866)(cid:1859)(cid:1857) (cid:4666)(cid:1866)(cid:4667): (cid:1868)(cid:1870)(cid:1861)(cid:1866)(cid:1872) (cid:4666)(cid:4667)