<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.ubc.ca/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Niels</id>
	<title>UBC Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.ubc.ca/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Niels"/>
	<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/Special:Contributions/Niels"/>
	<updated>2026-10-02T06:49:16Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.10</generator>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=User:Niels&amp;diff=19063</id>
		<title>User:Niels</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=User:Niels&amp;diff=19063"/>
		<updated>2010-02-02T02:38:54Z</updated>

		<summary type="html">&lt;p&gt;Niels: Created page with &amp;#039;=== Niels is Cool! ===  Currently a CPSC student in Course:CPSC 320 with Steve Wolfman.&amp;#039;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Niels is Cool! ===&lt;br /&gt;
&lt;br /&gt;
Currently a CPSC student in [[Course:CPSC 320]] with Steve Wolfman.&lt;/div&gt;</summary>
		<author><name>Niels</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC_320/Midterm_1_Reference_Sheet&amp;diff=19062</id>
		<title>Course:CPSC 320/Midterm 1 Reference Sheet</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC_320/Midterm_1_Reference_Sheet&amp;diff=19062"/>
		<updated>2010-02-02T02:28:28Z</updated>

		<summary type="html">&lt;p&gt;Niels: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== CPSC 320 2009W2 Exam Reference Sheet ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Do not remove:&#039;&#039;&#039; This reference sheet is the appendix for Midterm #1.  Only the first 4 printed pages will be used; so be compact!&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in O(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;\exist c \in \mathbf{R^+}, \exist n_0 \in \mathbf{Z^+}, \forall n \in \mathbf{Z^+}, n \geq n_0 \rightarrow f(n) \leq c g(n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in \Omega(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;g(n) \in O(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in \Theta(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;f(n) \in O(g(n))&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;g(n) \in O(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in o(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;\forall c \in \mathbf{R^+}, \exist n_0 \in \mathbf{Z^+}, \forall n \in \mathbf{Z^+}, n \geq n_0 \rightarrow f(n) &amp;lt; c g(n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in \omega(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;g(n) \in o(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also, if &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} =&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;f(n) \in \omega(g(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* a non-zero constant, then &amp;lt;math&amp;gt;f(n) \in \Theta(g(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;f(n) \in o(g(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(Plus bear in mind that (1) L&#039;Hopital&#039;s rule may be handy, and (2) the limit is not always well-defined!)&lt;br /&gt;
&lt;br /&gt;
L&#039;Hopital&#039;s Rule:&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} = \frac{0}{0}&amp;lt;/math&amp;gt;  or &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} = \frac{\infty}{\infty}&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} = \frac{f(n)&#039;}{g(n)&#039;}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Analogy to Inequalities ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = O(g(n))&amp;lt;/math&amp;gt; if and only if &amp;lt;math&amp;gt;g(n) = \Omega(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = o(g(n))&amp;lt;/math&amp;gt; if and only if &amp;lt;math&amp;gt;g(n) = \omega(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It follows, where &amp;lt;math&amp;gt;a \rightarrow f(n)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;b \rightarrow g(n)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = O(g(n)) \approx a \leq b&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = \Omega(g(n)) \approx a \geq b&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = \Theta(g(n)) \approx a = b&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = o(g(n)) \approx a &amp;lt; b&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = \omega(g(n)) \approx a &amp;gt; b&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Caution: For all &amp;lt;math&amp;gt;a, b, \in \mathbf{R}&amp;lt;/math&amp;gt; exactly one must hold: &amp;lt;math&amp;gt; a&amp;lt;b, a=b&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt; a&amp;gt;b &amp;lt;/math&amp;gt;.  Not all functions are asymptotically comparable.&lt;br /&gt;
&lt;br /&gt;
=== Master Theorem ===&lt;br /&gt;
If &amp;lt;math&amp;gt;\displaystyle T(n) = aT(&#039;&#039;n/b&#039;&#039;) + f(n)&amp;lt;/math&amp;gt; and a constant in the base case, where &amp;lt;math&amp;gt;&#039;&#039;n/b&#039;&#039;&amp;lt;/math&amp;gt; can be either &amp;lt;math&amp;gt;\lfloor n/b \rfloor&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;\lceil n/b \rceil&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt; a &amp;gt;= 1 &amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; b &amp;gt; 1 &amp;lt;/math&amp;gt; then:&lt;br /&gt;
* If &amp;lt;math&amp;gt;f(n) \in O(n^{log_b {a-\mathcal{E}}})&amp;lt;/math&amp;gt; for some &amp;lt;math&amp;gt;\mathcal{E} &amp;gt;0&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;T(n) \in \Theta(n^{log_b a})&amp;lt;/math&amp;gt;&lt;br /&gt;
** Dominated by leaf cost&lt;br /&gt;
* If &amp;lt;math&amp;gt;f(n) \in \Theta (n^{log_b a})&amp;lt;/math&amp;gt; then, &amp;lt;math&amp;gt;T(n) \in \Theta (n^{log_b a} lg n) &amp;lt;/math&amp;gt;&lt;br /&gt;
** Balanced cost&lt;br /&gt;
* If &amp;lt;math&amp;gt;f(n) \in \Omega(n^{log_b {a+\mathcal{E}}})&amp;lt;/math&amp;gt; for some &amp;lt;math&amp;gt;\mathcal{E} &amp;gt; 0&amp;lt;/math&amp;gt; and if &amp;lt;math&amp;gt;\displaystyle af(&#039;&#039;n/b&#039;&#039;) \leq cf(n)&amp;lt;/math&amp;gt; for some constant &amp;lt;math&amp;gt;\displaystyle c &amp;lt; 1&amp;lt;/math&amp;gt; and sufficiently large &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;T(n) \in \Theta(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
** Dominated by root cost&lt;br /&gt;
&lt;br /&gt;
The following equations cannot be solved using the master theorem:&amp;lt;ref&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 2^nT\left (\frac{n}{2}\right )+n^n&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&#039;&#039;a&#039;&#039; is not a constant&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 2T\left (\frac{n}{2}\right )+\frac{n}{\log n}&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;non-polynomial difference between f(n) and &amp;lt;math&amp;gt;n^{\log_b a}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 0.5T\left (\frac{n}{2}\right )+n&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&#039;&#039;a&#039;&#039;&amp;lt;1 cannot have less than one sub problem&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 64T\left (\frac{n}{8}\right )-n^2\log n&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;f(n) is not positive&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = T\left (\frac{n}{2}\right )+n(2-\cos n)&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;case 3 but regularity violation.&lt;br /&gt;
&lt;br /&gt;
Also, Case 3 always hold when f = n^k and If &amp;lt;math&amp;gt;f(n) \in \Omega(n^{log_b {a+\mathcal{E}}})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Log Laws ===&lt;br /&gt;
For all real a &amp;gt; 0, b &amp;gt; 0, c &amp;gt; 0, and n, &lt;br /&gt;
*&amp;lt;math&amp;gt;a = b^{\log_b a}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_c ab = \log_c a + \log_c b&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b a^n = n \log_b a&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b a = \frac{\log_c a}{\log_c b}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b \frac{1}{a} = -\log_b a&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b a = \frac{1}{\log_a b}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;a^{\log_b c} = c^{\log_b a}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Summation ===&lt;br /&gt;
*Arithmetic Series:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=1}^n(k) = 1 + 2 + \dots + n} = \frac{1}{2}n(n + 1)&amp;lt;/math&amp;gt;&lt;br /&gt;
*Sum of Squares:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^n(k^2)} = \frac{n(n+1)(2n+1)}{6}&amp;lt;/math&amp;gt;&lt;br /&gt;
*Sum of Cubes:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^n(k^3)} = \frac{n^2(n+1)^2}{4}&amp;lt;/math&amp;gt;&lt;br /&gt;
*Geometric Series:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^n(x^k) = 1 + x + x^2 + \dots + x^k} = \frac{x^{n + 1} - 1}{x -1 }, &amp;lt;/math&amp;gt; for real &amp;lt;math&amp;gt; x \ne 1&amp;lt;/math&amp;gt;&lt;br /&gt;
*Infinite decreasing: &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^{\infty}(x^k) = \frac{1}{ 1 - x }, for  |x| &amp;lt; 1 } &amp;lt;/math&amp;gt;&lt;br /&gt;
*Telescoping: &amp;lt;math&amp;gt; \displaystyle{\sum_{k=1}^{n-1}(a_{k} - a_{k +1}) = a_0 - a_n } &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Exponents===&lt;br /&gt;
* &amp;lt;math&amp;gt;a^0 = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a^1 = a&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a^{-1} = \frac{1}{a}&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;(a^m)^n = a^{mn}&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a^m \times a^n = a^{m+n}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Decision Tree-Related Notes ===&lt;br /&gt;
&lt;br /&gt;
* for a list of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; elements, there&#039;s &amp;lt;math&amp;gt;n!&amp;lt;/math&amp;gt; permutations&lt;br /&gt;
* a binary tree of height &amp;lt;math&amp;gt;d&amp;lt;/math&amp;gt; has at most &amp;lt;math&amp;gt;2^d&amp;lt;/math&amp;gt; leaves&lt;br /&gt;
* therefore, a binary tree with at least &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; leaves must have height at least &amp;lt;math&amp;gt;\lceil \lg n\rceil&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;\lg(n!) \in \Theta(n \lg n)&amp;lt;/math&amp;gt;, which we can establish by proving big-O and big-&amp;amp;Omega; bounds separately (pumping &amp;quot;up&amp;quot; or &amp;quot;down&amp;quot; the values of the terms in the factorial and the overall number of terms as needed)&lt;br /&gt;
&lt;br /&gt;
=== Stirling&#039;s Approximation ===&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;\ln n! \sim n\ln n - n\ .&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Derivatives ===&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{d}{dx} a^{f(x)} = a^{f(x)} * \frac{d(f(x))}{dx} ln(a) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== The Silicon Downs : Furlongs of Asymptotic Complexity ===&lt;br /&gt;
&lt;br /&gt;
&amp;quot;NEWS FLASH: Mounties Find Silicon Downs Fixed!&amp;quot;&lt;br /&gt;
* Constant &amp;lt;math&amp;gt; \in O(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Logarithmic &amp;lt;math&amp;gt; \in O(log n)&amp;lt;/math&amp;gt;   ie. &amp;lt;math&amp;gt;log_k n , log n^2 \in O(log n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Poly-Log &amp;lt;math&amp;gt; \in O(log^k n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Linear &amp;lt;math&amp;gt; \in O(n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Log-Linear &amp;lt;math&amp;gt; \in O(nlog n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Superlinear &amp;lt;math&amp;gt; \in O(n^{1+c})&amp;lt;/math&amp;gt; where: c is a constant &amp;gt; 0&lt;br /&gt;
* Quadratic &amp;lt;math&amp;gt; \in O(n^2)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Cubic &amp;lt;math&amp;gt; \in O(n^3)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Polynomial &amp;lt;math&amp;gt; \in O(n^k)&amp;lt;/math&amp;gt; where: k is a constant, &amp;quot;tractable&amp;quot;&lt;br /&gt;
* Exponential &amp;lt;math&amp;gt; \in O(c^n)&amp;lt;/math&amp;gt; where: c is a constant &amp;gt; 1, &amp;quot;intractable&amp;quot;&lt;/div&gt;</summary>
		<author><name>Niels</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC_320/Midterm_1_Reference_Sheet&amp;diff=19061</id>
		<title>Course:CPSC 320/Midterm 1 Reference Sheet</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC_320/Midterm_1_Reference_Sheet&amp;diff=19061"/>
		<updated>2010-02-02T02:27:22Z</updated>

		<summary type="html">&lt;p&gt;Niels: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== CPSC 320 2009W2 Exam Reference Sheet ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Do not remove:&#039;&#039;&#039; This reference sheet is the appendix for Midterm #1.  Only the first 4 printed pages will be used; so be compact!&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in O(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;\exist c \in \mathbf{R^+}, \exist n_0 \in \mathbf{Z^+}, \forall n \in \mathbf{Z^+}, n \geq n_0 \rightarrow f(n) \leq c g(n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in \Omega(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;g(n) \in O(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in \Theta(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;f(n) \in O(g(n))&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;g(n) \in O(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in o(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;\forall c \in \mathbf{R^+}, \exist n_0 \in \mathbf{Z^+}, \forall n \in \mathbf{Z^+}, n \geq n_0 \rightarrow f(n) &amp;lt; c g(n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in \omega(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;g(n) \in o(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also, if &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} =&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;f(n) \in \omega(g(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* a non-zero constant, then &amp;lt;math&amp;gt;f(n) \in \Theta(g(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;f(n) \in o(g(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(Plus bear in mind that (1) L&#039;Hopital&#039;s rule may be handy, and (2) the limit is not always well-defined!)&lt;br /&gt;
&lt;br /&gt;
L&#039;Hopital&#039;s Rule:&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} = \frac{0}{0}&amp;lt;/math&amp;gt;  or &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} = \frac{\infty}{\infty}&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} = \frac{f(n)&#039;}{g(n)&#039;}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Analogy to Inequalities ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = O(g(n))&amp;lt;/math&amp;gt; if and only if &amp;lt;math&amp;gt;g(n) = \Omega(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = o(g(n))&amp;lt;/math&amp;gt; if and only if &amp;lt;math&amp;gt;g(n) = \omega(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It follows, where &amp;lt;math&amp;gt;a \rightarrow f(n)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;b \rightarrow g(n)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = O(g(n)) \approx a \leq b&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = \Omega(g(n)) \approx a \geq b&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = \Theta(g(n)) \approx a = b&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = o(g(n)) \approx a &amp;lt; b&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = \omega(g(n)) \approx a &amp;gt; b&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Caution: For all &amp;lt;math&amp;gt;a, b, \in \mathbf{R}&amp;lt;/math&amp;gt; exactly one must hold: &amp;lt;math&amp;gt; a&amp;lt;b, a=b&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt; a&amp;gt;b &amp;lt;/math&amp;gt;.  Not all functions are asymptotically comparable.&lt;br /&gt;
&lt;br /&gt;
=== Master Theorem ===&lt;br /&gt;
If &amp;lt;math&amp;gt;\displaystyle T(n) = aT(&#039;&#039;n/b&#039;&#039;) + f(n)&amp;lt;/math&amp;gt; and a constant in the base case, where &amp;lt;math&amp;gt;&#039;&#039;n/b&#039;&#039;&amp;lt;/math&amp;gt; can be either &amp;lt;math&amp;gt;\lfloor n/b \rfloor&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;\lceil n/b \rceil&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt; a &amp;gt;= 1 &amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; b &amp;gt; 1 &amp;lt;/math&amp;gt; then:&lt;br /&gt;
* If &amp;lt;math&amp;gt;f(n) \in O(n^{log_b {a-\mathcal{E}}})&amp;lt;/math&amp;gt; for some &amp;lt;math&amp;gt;\mathcal{E} &amp;gt;0&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;T(n) \in \Theta(n^{log_b a})&amp;lt;/math&amp;gt;&lt;br /&gt;
** Dominated by leaf cost&lt;br /&gt;
* If &amp;lt;math&amp;gt;f(n) \in \Theta (n^{log_b a})&amp;lt;/math&amp;gt; then, &amp;lt;math&amp;gt;T(n) \in \Theta (n^{log_b a} lg n) &amp;lt;/math&amp;gt;&lt;br /&gt;
** Balanced cost&lt;br /&gt;
* If &amp;lt;math&amp;gt;f(n) \in \Omega(n^{log_b {a+\mathcal{E}}})&amp;lt;/math&amp;gt; for some &amp;lt;math&amp;gt;\mathcal{E} &amp;gt; 0&amp;lt;/math&amp;gt; and if &amp;lt;math&amp;gt;\displaystyle af(&#039;&#039;n/b&#039;&#039;) \leq cf(n)&amp;lt;/math&amp;gt; for some constant &amp;lt;math&amp;gt;\displaystyle c &amp;lt; 1&amp;lt;/math&amp;gt; and sufficiently large &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;T(n) \in \Theta(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
** Dominated by root cost&lt;br /&gt;
&lt;br /&gt;
The following equations cannot be solved using the master theorem:&amp;lt;ref&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 2^nT\left (\frac{n}{2}\right )+n^n&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&#039;&#039;a&#039;&#039; is not a constant&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 2T\left (\frac{n}{2}\right )+\frac{n}{\log n}&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;non-polynomial difference between f(n) and &amp;lt;math&amp;gt;n^{\log_b a}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 0.5T\left (\frac{n}{2}\right )+n&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&#039;&#039;a&#039;&#039;&amp;lt;1 cannot have less than one sub problem&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 64T\left (\frac{n}{8}\right )-n^2\log n&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;f(n) is not positive&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = T\left (\frac{n}{2}\right )+n(2-\cos n)&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;case 3 but regularity violation.&lt;br /&gt;
&lt;br /&gt;
Also, Case 3 always hold when f = n^k and If &amp;lt;math&amp;gt;f(n) \in \Omega(n^{log_b {a+\mathcal{E}}})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Log Laws ===&lt;br /&gt;
For all real a &amp;gt; 0, b &amp;gt; 0, c &amp;gt; 0, and n, &lt;br /&gt;
*&amp;lt;math&amp;gt;a = b^{\log_b a}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_c ab = \log_c a + \log_c b&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b a^n = n \log_b a&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b a = \frac{\log_c a}{\log_c b}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b \frac{1}{a} = -\log_b a&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b a = \frac{1}{\log_a b}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;a^{\log_b c} = c^{\log_b a}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Summation ===&lt;br /&gt;
*Arithmetic Series:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=1}^n(k) = 1 + 2 + \dots + n} = \frac{1}{2}n(n + 1)&amp;lt;/math&amp;gt;&lt;br /&gt;
*Sum of Squares:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^n(k^2)} = \frac{n(n+1)(2n+1)}{6}&amp;lt;/math&amp;gt;&lt;br /&gt;
*Sum of Cubes:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^n(k^3)} = \frac{n^2(n+1)^2}{4}&amp;lt;/math&amp;gt;&lt;br /&gt;
*Geometric Series:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^n(x^k) = 1 + x + x^2 + \dots + x^k} = \frac{x^{n + 1} - 1}{x -1 }, &amp;lt;/math&amp;gt; for real &amp;lt;math&amp;gt; x \ne 1&amp;lt;/math&amp;gt;&lt;br /&gt;
*Infinite decreasing: &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^{\infty}(x^k) = \frac{1}{ 1 - x }, for  |x| &amp;lt; 1 } &amp;lt;/math&amp;gt;&lt;br /&gt;
*Telescoping: &amp;lt;math&amp;gt; \displaystyle{\sum_{k=1}^{n-1}(a_{k} - a_{k +1}) = a_0 - a_n } &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Exponents===&lt;br /&gt;
* &amp;lt;math&amp;gt;a^0 = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a^1 = a&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a^{-1} = \frac{1}{a}&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;(a^m)^n = a^{mn}&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a^m \times a^n = a^{m+n}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Decision Tree-Related Notes ===&lt;br /&gt;
&lt;br /&gt;
* for a list of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; elements, there&#039;s &amp;lt;math&amp;gt;n!&amp;lt;/math&amp;gt; permutations&lt;br /&gt;
* a binary tree of height &amp;lt;math&amp;gt;d&amp;lt;/math&amp;gt; has at most &amp;lt;math&amp;gt;2^d&amp;lt;/math&amp;gt; leaves&lt;br /&gt;
* therefore, a binary tree with at least &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; leaves must have height at least &amp;lt;math&amp;gt;\lceil \lg n\rceil&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;\lg(n!) \in \Theta(n \lg n)&amp;lt;/math&amp;gt;, which we can establish by proving big-O and big-&amp;amp;Omega; bounds separately (pumping &amp;quot;up&amp;quot; or &amp;quot;down&amp;quot; the values of the terms in the factorial and the overall number of terms as needed)&lt;br /&gt;
&lt;br /&gt;
=== Stirling&#039;s Approximation ===&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;\ln n! \sim n\ln n - n\ .&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Derivatives ===&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{d}{dx} a^{f(x)} = a^{f(x)} * \frac{d(f(x))}{dx} ln(a) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== The Silicon Downs : Furlongs of Asymptotic Complexity ===&lt;br /&gt;
&lt;br /&gt;
&amp;quot;NEWS FLASH: Mounties Find Silicon Downs Fixed!&amp;quot;&lt;br /&gt;
* Constant &amp;lt;math&amp;gt; \in O(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Logarithmic &amp;lt;math&amp;gt; \in O(log n)&amp;lt;/math&amp;gt;   ie. &amp;lt;math&amp;gt;log_k n , log n^2 \in O(log n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Poly-Log &amp;lt;math&amp;gt; \in O(log^k n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Linear &amp;lt;math&amp;gt; \in O(n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Log-Linear &amp;lt;math&amp;gt; \in O(nlog n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Superlinear &amp;lt;math&amp;gt; \in O(n^{1+c})&amp;lt;/math&amp;gt; where: c is a constant &amp;gt; 0&lt;br /&gt;
* Quadratic &amp;lt;math&amp;gt; \in O(n^2)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Cubic &amp;lt;math&amp;gt; \in O(n^3)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Polynomial &amp;lt;math&amp;gt; \in O(n^k)&amp;lt;/math&amp;gt; where: k is a constant, &amp;quot;tractable&amp;quot;&lt;br /&gt;
* Exponential &amp;lt;math&amp;gt; \in O(c^n)&amp;lt;/math&amp;gt; where: c is a constant &amp;gt; 1, &amp;quot;intractable&amp;quot;&lt;/div&gt;</summary>
		<author><name>Niels</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC_320/Midterm_1_Reference_Sheet&amp;diff=19060</id>
		<title>Course:CPSC 320/Midterm 1 Reference Sheet</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC_320/Midterm_1_Reference_Sheet&amp;diff=19060"/>
		<updated>2010-02-02T02:20:21Z</updated>

		<summary type="html">&lt;p&gt;Niels: /* Derivatives */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== CPSC 320 2009W2 Exam Reference Sheet ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Do not remove:&#039;&#039;&#039; This reference sheet is the appendix for Midterm #1.  Only the first 4 printed pages will be used; so be compact!&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in O(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;\exist c \in \mathbf{R^+}, \exist n_0 \in \mathbf{Z^+}, \forall n \in \mathbf{Z^+}, n \geq n_0 \rightarrow f(n) \leq c g(n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in \Omega(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;g(n) \in O(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in \Theta(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;f(n) \in O(g(n))&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;g(n) \in O(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in o(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;\forall c \in \mathbf{R^+}, \exist n_0 \in \mathbf{Z^+}, \forall n \in \mathbf{Z^+}, n \geq n_0 \rightarrow f(n) &amp;lt; c g(n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in \omega(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;g(n) \in o(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also, if &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} =&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;f(n) \in \omega(g(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* a non-zero constant, then &amp;lt;math&amp;gt;f(n) \in \Theta(g(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;f(n) \in o(g(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(Plus bear in mind that (1) L&#039;Hopital&#039;s rule may be handy, and (2) the limit is not always well-defined!)&lt;br /&gt;
&lt;br /&gt;
L&#039;Hopital&#039;s Rule:&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} = \frac{0}{0}&amp;lt;/math&amp;gt;  or &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} = \frac{\infty}{\infty}&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} = \frac{f(n)&#039;}{g(n)&#039;}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Analogy to Inequalities ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = O(g(n))&amp;lt;/math&amp;gt; if and only if &amp;lt;math&amp;gt;g(n) = \Omega(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = o(g(n))&amp;lt;/math&amp;gt; if and only if &amp;lt;math&amp;gt;g(n) = \omega(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It follows, where &amp;lt;math&amp;gt;a \rightarrow f(n)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;b \rightarrow g(n)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = O(g(n)) \approx a \leq b&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = \Omega(g(n)) \approx a \geq b&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = \Theta(g(n)) \approx a = b&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = o(g(n)) \approx a &amp;lt; b&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = \omega(g(n)) \approx a &amp;gt; b&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Caution: For all &amp;lt;math&amp;gt;a, b, \in \mathbf{R}&amp;lt;/math&amp;gt; exactly one must hold: &amp;lt;math&amp;gt; a&amp;lt;b, a=b&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt; a&amp;gt;b &amp;lt;/math&amp;gt;.  Not all functions are asymptotically comparable.&lt;br /&gt;
&lt;br /&gt;
=== Master Theorem ===&lt;br /&gt;
If &amp;lt;math&amp;gt;\displaystyle T(n) = aT(&#039;&#039;n/b&#039;&#039;) + f(n)&amp;lt;/math&amp;gt; and a constant in the base case, where &amp;lt;math&amp;gt;&#039;&#039;n/b&#039;&#039;&amp;lt;/math&amp;gt; can be either &amp;lt;math&amp;gt;\lfloor n/b \rfloor&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;\lceil n/b \rceil&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt; a &amp;gt;= 1 &amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; b &amp;gt; 1 &amp;lt;/math&amp;gt; then:&lt;br /&gt;
* If &amp;lt;math&amp;gt;f(n) \in O(n^{log_b {a-\mathcal{E}}})&amp;lt;/math&amp;gt; for some &amp;lt;math&amp;gt;\mathcal{E} &amp;gt;0&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;T(n) \in \Theta(n^{log_b a})&amp;lt;/math&amp;gt;&lt;br /&gt;
** Dominated by leaf cost&lt;br /&gt;
* If &amp;lt;math&amp;gt;f(n) \in \Theta (n^{log_b a})&amp;lt;/math&amp;gt; then, &amp;lt;math&amp;gt;T(n) \in \Theta (n^{log_b a} lg n) &amp;lt;/math&amp;gt;&lt;br /&gt;
** Balanced cost&lt;br /&gt;
* If &amp;lt;math&amp;gt;f(n) \in \Omega(n^{log_b {a+\mathcal{E}}})&amp;lt;/math&amp;gt; for some &amp;lt;math&amp;gt;\mathcal{E} &amp;gt; 0&amp;lt;/math&amp;gt; and if &amp;lt;math&amp;gt;\displaystyle af(&#039;&#039;n/b&#039;&#039;) \leq cf(n)&amp;lt;/math&amp;gt; for some constant &amp;lt;math&amp;gt;\displaystyle c &amp;lt; 1&amp;lt;/math&amp;gt; and sufficiently large &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;T(n) \in \Theta(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
** Dominated by root cost&lt;br /&gt;
&lt;br /&gt;
The following equations cannot be solved using the master theorem:&amp;lt;ref&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 2^nT\left (\frac{n}{2}\right )+n^n&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&#039;&#039;a&#039;&#039; is not a constant&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 2T\left (\frac{n}{2}\right )+\frac{n}{\log n}&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;non-polynomial difference between f(n) and &amp;lt;math&amp;gt;n^{\log_b a}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 0.5T\left (\frac{n}{2}\right )+n&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&#039;&#039;a&#039;&#039;&amp;lt;1 cannot have less than one sub problem&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 64T\left (\frac{n}{8}\right )-n^2\log n&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;f(n) is not positive&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = T\left (\frac{n}{2}\right )+n(2-\cos n)&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;case 3 but regularity violation.&lt;br /&gt;
&lt;br /&gt;
Also, Case 3 always hold when f = n^k and If &amp;lt;math&amp;gt;f(n) \in \Omega(n^{log_b {a+\mathcal{E}}})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Log Laws ===&lt;br /&gt;
For all real a &amp;gt; 0, b &amp;gt; 0, c &amp;gt; 0, and n, &lt;br /&gt;
*&amp;lt;math&amp;gt;a = b^{\log_b a}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_c ab = \log_c a + \log_c b&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b a^n = n \log_b a&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b a = \frac{\log_c a}{\log_c b}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b \frac{1}{a} = -\log_b a&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b a = \frac{1}{\log_a b}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;a^{\log_b c} = c^{\log_b a}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Summation ===&lt;br /&gt;
*Arithmetic Series:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=1}^n(k) = 1 + 2 + \dots + n} = \frac{1}{2}n(n + 1)&amp;lt;/math&amp;gt;&lt;br /&gt;
*Sum of Squares:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^n(k^2)} = \frac{n(n+1)(2n+1)}{6}&amp;lt;/math&amp;gt;&lt;br /&gt;
*Sum of Cubes:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^n(k^3)} = \frac{n^2(n+1)^2}{4}&amp;lt;/math&amp;gt;&lt;br /&gt;
*Geometric Series:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^n(x^k) = 1 + x + x^2 + \dots + x^k} = \frac{x^{n + 1} - 1}{x -1 }, &amp;lt;/math&amp;gt; for real &amp;lt;math&amp;gt; x \ne 1&amp;lt;/math&amp;gt;&lt;br /&gt;
*Infinite decreasing: &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^{\infty}(x^k) = \frac{1}{ 1 - x }, for  |x| &amp;lt; 1 } &amp;lt;/math&amp;gt;&lt;br /&gt;
*Telescoping: &amp;lt;math&amp;gt; \displaystyle{\sum_{k=1}^{n-1}(a_{k} - a_{k +1}) = a_0 - a_n } &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Exponents===&lt;br /&gt;
* &amp;lt;math&amp;gt;a^0 = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a^1 = a&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a^{-1} = \frac{1}{a}&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;(a^m)^n = a^{mn}&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a^m \times a^n = a^{m+n}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Decision Tree-Related Notes ===&lt;br /&gt;
&lt;br /&gt;
* for a list of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; elements, there&#039;s &amp;lt;math&amp;gt;n!&amp;lt;/math&amp;gt; permutations&lt;br /&gt;
* a binary tree of height &amp;lt;math&amp;gt;d&amp;lt;/math&amp;gt; has at most &amp;lt;math&amp;gt;2^d&amp;lt;/math&amp;gt; leaves&lt;br /&gt;
* therefore, a binary tree with at least &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; leaves must have height at least &amp;lt;math&amp;gt;\lceil \lg n\rceil&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;\lg(n!) \in \Theta(n \lg n)&amp;lt;/math&amp;gt;, which we can establish by proving big-O and big-&amp;amp;Omega; bounds separately (pumping &amp;quot;up&amp;quot; or &amp;quot;down&amp;quot; the values of the terms in the factorial and the overall number of terms as needed)&lt;br /&gt;
&lt;br /&gt;
=== Stirling&#039;s Approximation ===&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;\ln n! \sim n\ln n - n\ .&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Derivatives ===&lt;br /&gt;
&amp;lt;math&amp;gt; d/dx a^f(x) = a^f(x) * d(f(x))/dx * ln(a) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== The Silicon Downs : Furlongs of Asymptotic Complexity ===&lt;br /&gt;
&lt;br /&gt;
&amp;quot;NEWS FLASH: Mounties Find Silicon Downs Fixed!&amp;quot;&lt;br /&gt;
* Constant &amp;lt;math&amp;gt; \in O(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Logarithmic &amp;lt;math&amp;gt; \in O(log n)&amp;lt;/math&amp;gt;   ie. &amp;lt;math&amp;gt;log_k n , log n^2 \in O(log n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Poly-Log &amp;lt;math&amp;gt; \in O(log^k n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Linear &amp;lt;math&amp;gt; \in O(n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Log-Linear &amp;lt;math&amp;gt; \in O(nlog n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Superlinear &amp;lt;math&amp;gt; \in O(n^{1+c})&amp;lt;/math&amp;gt; where: c is a constant &amp;gt; 0&lt;br /&gt;
* Quadratic &amp;lt;math&amp;gt; \in O(n^2)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Cubic &amp;lt;math&amp;gt; \in O(n^3)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Polynomial &amp;lt;math&amp;gt; \in O(n^k)&amp;lt;/math&amp;gt; where: k is a constant, &amp;quot;tractable&amp;quot;&lt;br /&gt;
* Exponential &amp;lt;math&amp;gt; \in O(c^n)&amp;lt;/math&amp;gt; where: c is a constant &amp;gt; 1, &amp;quot;intractable&amp;quot;&lt;/div&gt;</summary>
		<author><name>Niels</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC_320/Midterm_1_Reference_Sheet&amp;diff=19059</id>
		<title>Course:CPSC 320/Midterm 1 Reference Sheet</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC_320/Midterm_1_Reference_Sheet&amp;diff=19059"/>
		<updated>2010-02-02T02:19:44Z</updated>

		<summary type="html">&lt;p&gt;Niels: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== CPSC 320 2009W2 Exam Reference Sheet ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Do not remove:&#039;&#039;&#039; This reference sheet is the appendix for Midterm #1.  Only the first 4 printed pages will be used; so be compact!&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in O(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;\exist c \in \mathbf{R^+}, \exist n_0 \in \mathbf{Z^+}, \forall n \in \mathbf{Z^+}, n \geq n_0 \rightarrow f(n) \leq c g(n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in \Omega(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;g(n) \in O(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in \Theta(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;f(n) \in O(g(n))&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;g(n) \in O(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in o(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;\forall c \in \mathbf{R^+}, \exist n_0 \in \mathbf{Z^+}, \forall n \in \mathbf{Z^+}, n \geq n_0 \rightarrow f(n) &amp;lt; c g(n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in \omega(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;g(n) \in o(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also, if &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} =&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;f(n) \in \omega(g(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* a non-zero constant, then &amp;lt;math&amp;gt;f(n) \in \Theta(g(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;f(n) \in o(g(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(Plus bear in mind that (1) L&#039;Hopital&#039;s rule may be handy, and (2) the limit is not always well-defined!)&lt;br /&gt;
&lt;br /&gt;
L&#039;Hopital&#039;s Rule:&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} = \frac{0}{0}&amp;lt;/math&amp;gt;  or &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} = \frac{\infty}{\infty}&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} = \frac{f(n)&#039;}{g(n)&#039;}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Analogy to Inequalities ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = O(g(n))&amp;lt;/math&amp;gt; if and only if &amp;lt;math&amp;gt;g(n) = \Omega(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = o(g(n))&amp;lt;/math&amp;gt; if and only if &amp;lt;math&amp;gt;g(n) = \omega(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It follows, where &amp;lt;math&amp;gt;a \rightarrow f(n)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;b \rightarrow g(n)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = O(g(n)) \approx a \leq b&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = \Omega(g(n)) \approx a \geq b&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = \Theta(g(n)) \approx a = b&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = o(g(n)) \approx a &amp;lt; b&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = \omega(g(n)) \approx a &amp;gt; b&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Caution: For all &amp;lt;math&amp;gt;a, b, \in \mathbf{R}&amp;lt;/math&amp;gt; exactly one must hold: &amp;lt;math&amp;gt; a&amp;lt;b, a=b&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt; a&amp;gt;b &amp;lt;/math&amp;gt;.  Not all functions are asymptotically comparable.&lt;br /&gt;
&lt;br /&gt;
=== Master Theorem ===&lt;br /&gt;
If &amp;lt;math&amp;gt;\displaystyle T(n) = aT(&#039;&#039;n/b&#039;&#039;) + f(n)&amp;lt;/math&amp;gt; and a constant in the base case, where &amp;lt;math&amp;gt;&#039;&#039;n/b&#039;&#039;&amp;lt;/math&amp;gt; can be either &amp;lt;math&amp;gt;\lfloor n/b \rfloor&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;\lceil n/b \rceil&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt; a &amp;gt;= 1 &amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; b &amp;gt; 1 &amp;lt;/math&amp;gt; then:&lt;br /&gt;
* If &amp;lt;math&amp;gt;f(n) \in O(n^{log_b {a-\mathcal{E}}})&amp;lt;/math&amp;gt; for some &amp;lt;math&amp;gt;\mathcal{E} &amp;gt;0&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;T(n) \in \Theta(n^{log_b a})&amp;lt;/math&amp;gt;&lt;br /&gt;
** Dominated by leaf cost&lt;br /&gt;
* If &amp;lt;math&amp;gt;f(n) \in \Theta (n^{log_b a})&amp;lt;/math&amp;gt; then, &amp;lt;math&amp;gt;T(n) \in \Theta (n^{log_b a} lg n) &amp;lt;/math&amp;gt;&lt;br /&gt;
** Balanced cost&lt;br /&gt;
* If &amp;lt;math&amp;gt;f(n) \in \Omega(n^{log_b {a+\mathcal{E}}})&amp;lt;/math&amp;gt; for some &amp;lt;math&amp;gt;\mathcal{E} &amp;gt; 0&amp;lt;/math&amp;gt; and if &amp;lt;math&amp;gt;\displaystyle af(&#039;&#039;n/b&#039;&#039;) \leq cf(n)&amp;lt;/math&amp;gt; for some constant &amp;lt;math&amp;gt;\displaystyle c &amp;lt; 1&amp;lt;/math&amp;gt; and sufficiently large &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;T(n) \in \Theta(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
** Dominated by root cost&lt;br /&gt;
&lt;br /&gt;
The following equations cannot be solved using the master theorem:&amp;lt;ref&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 2^nT\left (\frac{n}{2}\right )+n^n&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&#039;&#039;a&#039;&#039; is not a constant&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 2T\left (\frac{n}{2}\right )+\frac{n}{\log n}&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;non-polynomial difference between f(n) and &amp;lt;math&amp;gt;n^{\log_b a}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 0.5T\left (\frac{n}{2}\right )+n&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&#039;&#039;a&#039;&#039;&amp;lt;1 cannot have less than one sub problem&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 64T\left (\frac{n}{8}\right )-n^2\log n&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;f(n) is not positive&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = T\left (\frac{n}{2}\right )+n(2-\cos n)&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;case 3 but regularity violation.&lt;br /&gt;
&lt;br /&gt;
Also, Case 3 always hold when f = n^k and If &amp;lt;math&amp;gt;f(n) \in \Omega(n^{log_b {a+\mathcal{E}}})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Log Laws ===&lt;br /&gt;
For all real a &amp;gt; 0, b &amp;gt; 0, c &amp;gt; 0, and n, &lt;br /&gt;
*&amp;lt;math&amp;gt;a = b^{\log_b a}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_c ab = \log_c a + \log_c b&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b a^n = n \log_b a&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b a = \frac{\log_c a}{\log_c b}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b \frac{1}{a} = -\log_b a&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b a = \frac{1}{\log_a b}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;a^{\log_b c} = c^{\log_b a}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Summation ===&lt;br /&gt;
*Arithmetic Series:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=1}^n(k) = 1 + 2 + \dots + n} = \frac{1}{2}n(n + 1)&amp;lt;/math&amp;gt;&lt;br /&gt;
*Sum of Squares:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^n(k^2)} = \frac{n(n+1)(2n+1)}{6}&amp;lt;/math&amp;gt;&lt;br /&gt;
*Sum of Cubes:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^n(k^3)} = \frac{n^2(n+1)^2}{4}&amp;lt;/math&amp;gt;&lt;br /&gt;
*Geometric Series:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^n(x^k) = 1 + x + x^2 + \dots + x^k} = \frac{x^{n + 1} - 1}{x -1 }, &amp;lt;/math&amp;gt; for real &amp;lt;math&amp;gt; x \ne 1&amp;lt;/math&amp;gt;&lt;br /&gt;
*Infinite decreasing: &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^{\infty}(x^k) = \frac{1}{ 1 - x }, for  |x| &amp;lt; 1 } &amp;lt;/math&amp;gt;&lt;br /&gt;
*Telescoping: &amp;lt;math&amp;gt; \displaystyle{\sum_{k=1}^{n-1}(a_{k} - a_{k +1}) = a_0 - a_n } &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Exponents===&lt;br /&gt;
* &amp;lt;math&amp;gt;a^0 = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a^1 = a&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a^{-1} = \frac{1}{a}&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;(a^m)^n = a^{mn}&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a^m \times a^n = a^{m+n}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Decision Tree-Related Notes ===&lt;br /&gt;
&lt;br /&gt;
* for a list of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; elements, there&#039;s &amp;lt;math&amp;gt;n!&amp;lt;/math&amp;gt; permutations&lt;br /&gt;
* a binary tree of height &amp;lt;math&amp;gt;d&amp;lt;/math&amp;gt; has at most &amp;lt;math&amp;gt;2^d&amp;lt;/math&amp;gt; leaves&lt;br /&gt;
* therefore, a binary tree with at least &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; leaves must have height at least &amp;lt;math&amp;gt;\lceil \lg n\rceil&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;\lg(n!) \in \Theta(n \lg n)&amp;lt;/math&amp;gt;, which we can establish by proving big-O and big-&amp;amp;Omega; bounds separately (pumping &amp;quot;up&amp;quot; or &amp;quot;down&amp;quot; the values of the terms in the factorial and the overall number of terms as needed)&lt;br /&gt;
&lt;br /&gt;
=== Stirling&#039;s Approximation ===&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;\ln n! \sim n\ln n - n\ .&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Derivatives ===&lt;br /&gt;
d/dx a^f(x) = a^f(x) * d(f(x))/dx * ln(a)&lt;br /&gt;
&lt;br /&gt;
=== The Silicon Downs : Furlongs of Asymptotic Complexity ===&lt;br /&gt;
&lt;br /&gt;
&amp;quot;NEWS FLASH: Mounties Find Silicon Downs Fixed!&amp;quot;&lt;br /&gt;
* Constant &amp;lt;math&amp;gt; \in O(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Logarithmic &amp;lt;math&amp;gt; \in O(log n)&amp;lt;/math&amp;gt;   ie. &amp;lt;math&amp;gt;log_k n , log n^2 \in O(log n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Poly-Log &amp;lt;math&amp;gt; \in O(log^k n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Linear &amp;lt;math&amp;gt; \in O(n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Log-Linear &amp;lt;math&amp;gt; \in O(nlog n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Superlinear &amp;lt;math&amp;gt; \in O(n^{1+c})&amp;lt;/math&amp;gt; where: c is a constant &amp;gt; 0&lt;br /&gt;
* Quadratic &amp;lt;math&amp;gt; \in O(n^2)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Cubic &amp;lt;math&amp;gt; \in O(n^3)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Polynomial &amp;lt;math&amp;gt; \in O(n^k)&amp;lt;/math&amp;gt; where: k is a constant, &amp;quot;tractable&amp;quot;&lt;br /&gt;
* Exponential &amp;lt;math&amp;gt; \in O(c^n)&amp;lt;/math&amp;gt; where: c is a constant &amp;gt; 1, &amp;quot;intractable&amp;quot;&lt;/div&gt;</summary>
		<author><name>Niels</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC_320/Midterm_1_Reference_Sheet&amp;diff=19058</id>
		<title>Course:CPSC 320/Midterm 1 Reference Sheet</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC_320/Midterm_1_Reference_Sheet&amp;diff=19058"/>
		<updated>2010-02-02T02:17:24Z</updated>

		<summary type="html">&lt;p&gt;Niels: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== CPSC 320 2009W2 Exam Reference Sheet ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Do not remove:&#039;&#039;&#039; This reference sheet is the appendix for Midterm #1.  Only the first 4 printed pages will be used; so be compact!&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in O(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;\exist c \in \mathbf{R^+}, \exist n_0 \in \mathbf{Z^+}, \forall n \in \mathbf{Z^+}, n \geq n_0 \rightarrow f(n) \leq c g(n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in \Omega(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;g(n) \in O(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in \Theta(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;f(n) \in O(g(n))&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;g(n) \in O(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in o(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;\forall c \in \mathbf{R^+}, \exist n_0 \in \mathbf{Z^+}, \forall n \in \mathbf{Z^+}, n \geq n_0 \rightarrow f(n) &amp;lt; c g(n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in \omega(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;g(n) \in o(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also, if &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} =&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;f(n) \in \omega(g(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* a non-zero constant, then &amp;lt;math&amp;gt;f(n) \in \Theta(g(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;f(n) \in o(g(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(Plus bear in mind that (1) L&#039;Hopital&#039;s rule may be handy, and (2) the limit is not always well-defined!)&lt;br /&gt;
&lt;br /&gt;
L&#039;Hopital&#039;s Rule:&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} = \frac{0}{0}&amp;lt;/math&amp;gt;  or &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} = \frac{\infty}{\infty}&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} = \frac{f(n)&#039;}{g(n)&#039;}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Analogy to Inequalities ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = O(g(n))&amp;lt;/math&amp;gt; if and only if &amp;lt;math&amp;gt;g(n) = \Omega(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = o(g(n))&amp;lt;/math&amp;gt; if and only if &amp;lt;math&amp;gt;g(n) = \omega(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It follows, where &amp;lt;math&amp;gt;a \approx f(n)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;b \approx f(n)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = O(g(n)) \approx a \leq b&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = \Omega(g(n)) \approx a \geq b&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = \Theta(g(n)) \approx a = b&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = o(g(n)) \approx a &amp;lt; b&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = \omega(g(n)) \approx a &amp;gt; b&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Caution: For all &amp;lt;math&amp;gt;a, b, \in \mathbf{R}&amp;lt;/math&amp;gt; exactly one must hold: &amp;lt;math&amp;gt; a&amp;lt;b, a=b&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt; a&amp;gt;b &amp;lt;/math&amp;gt;.  Not all functions are asymptotically comparable.&lt;br /&gt;
&lt;br /&gt;
=== Master Theorem ===&lt;br /&gt;
If &amp;lt;math&amp;gt;\displaystyle T(n) = aT(&#039;&#039;n/b&#039;&#039;) + f(n)&amp;lt;/math&amp;gt; and a constant in the base case, where &amp;lt;math&amp;gt;&#039;&#039;n/b&#039;&#039;&amp;lt;/math&amp;gt; can be either &amp;lt;math&amp;gt;\lfloor n/b \rfloor&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;\lceil n/b \rceil&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt; a &amp;gt;= 1 &amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; b &amp;gt; 1 &amp;lt;/math&amp;gt; then:&lt;br /&gt;
* If &amp;lt;math&amp;gt;f(n) \in O(n^{log_b {a-\mathcal{E}}})&amp;lt;/math&amp;gt; for some &amp;lt;math&amp;gt;\mathcal{E} &amp;gt;0&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;T(n) \in \Theta(n^{log_b a})&amp;lt;/math&amp;gt;&lt;br /&gt;
** Dominated by leaf cost&lt;br /&gt;
* If &amp;lt;math&amp;gt;f(n) \in \Theta (n^{log_b a})&amp;lt;/math&amp;gt; then, &amp;lt;math&amp;gt;T(n) \in \Theta (n^{log_b a} lg n) &amp;lt;/math&amp;gt;&lt;br /&gt;
** Balanced cost&lt;br /&gt;
* If &amp;lt;math&amp;gt;f(n) \in \Omega(n^{log_b {a+\mathcal{E}}})&amp;lt;/math&amp;gt; for some &amp;lt;math&amp;gt;\mathcal{E} &amp;gt; 0&amp;lt;/math&amp;gt; and if &amp;lt;math&amp;gt;\displaystyle af(&#039;&#039;n/b&#039;&#039;) \leq cf(n)&amp;lt;/math&amp;gt; for some constant &amp;lt;math&amp;gt;\displaystyle c &amp;lt; 1&amp;lt;/math&amp;gt; and sufficiently large &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;T(n) \in \Theta(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
** Dominated by root cost&lt;br /&gt;
&lt;br /&gt;
The following equations cannot be solved using the master theorem:&amp;lt;ref&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 2^nT\left (\frac{n}{2}\right )+n^n&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&#039;&#039;a&#039;&#039; is not a constant&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 2T\left (\frac{n}{2}\right )+\frac{n}{\log n}&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;non-polynomial difference between f(n) and &amp;lt;math&amp;gt;n^{\log_b a}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 0.5T\left (\frac{n}{2}\right )+n&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&#039;&#039;a&#039;&#039;&amp;lt;1 cannot have less than one sub problem&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 64T\left (\frac{n}{8}\right )-n^2\log n&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;f(n) is not positive&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = T\left (\frac{n}{2}\right )+n(2-\cos n)&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;case 3 but regularity violation.&lt;br /&gt;
&lt;br /&gt;
Also, Case 3 always hold when f = n^k and If &amp;lt;math&amp;gt;f(n) \in \Omega(n^{log_b {a+\mathcal{E}}})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Log Laws ===&lt;br /&gt;
For all real a &amp;gt; 0, b &amp;gt; 0, c &amp;gt; 0, and n, &lt;br /&gt;
*&amp;lt;math&amp;gt;a = b^{\log_b a}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_c ab = \log_c a + \log_c b&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b a^n = n \log_b a&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b a = \frac{\log_c a}{\log_c b}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b \frac{1}{a} = -\log_b a&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b a = \frac{1}{\log_a b}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;a^{\log_b c} = c^{\log_b a}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Summation ===&lt;br /&gt;
*Arithmetic Series:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=1}^n(k) = 1 + 2 + \dots + n} = \frac{1}{2}n(n + 1)&amp;lt;/math&amp;gt;&lt;br /&gt;
*Sum of Squares:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^n(k^2)} = \frac{n(n+1)(2n+1)}{6}&amp;lt;/math&amp;gt;&lt;br /&gt;
*Sum of Cubes:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^n(k^3)} = \frac{n^2(n+1)^2}{4}&amp;lt;/math&amp;gt;&lt;br /&gt;
*Geometric Series:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^n(x^k) = 1 + x + x^2 + \dots + x^k} = \frac{x^{n + 1} - 1}{x -1 }, &amp;lt;/math&amp;gt; for real &amp;lt;math&amp;gt; x \ne 1&amp;lt;/math&amp;gt;&lt;br /&gt;
*Infinite decreasing: &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^{\infty}(x^k) = \frac{1}{ 1 - x }, for  |x| &amp;lt; 1 } &amp;lt;/math&amp;gt;&lt;br /&gt;
*Telescoping: &amp;lt;math&amp;gt; \displaystyle{\sum_{k=1}^{n-1}(a_{k} - a_{k +1}) = a_0 - a_n } &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Exponents===&lt;br /&gt;
* &amp;lt;math&amp;gt;a^0 = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a^1 = a&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a^{-1} = \frac{1}{a}&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;(a^m)^n = a^{mn}&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a^m \times a^n = a^{m+n}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Decision Tree-Related Notes ===&lt;br /&gt;
&lt;br /&gt;
* for a list of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; elements, there&#039;s &amp;lt;math&amp;gt;n!&amp;lt;/math&amp;gt; permutations&lt;br /&gt;
* a binary tree of height &amp;lt;math&amp;gt;d&amp;lt;/math&amp;gt; has at most &amp;lt;math&amp;gt;2^d&amp;lt;/math&amp;gt; leaves&lt;br /&gt;
* therefore, a binary tree with at least &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; leaves must have height at least &amp;lt;math&amp;gt;\lceil \lg n\rceil&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;\lg(n!) \in \Theta(n \lg n)&amp;lt;/math&amp;gt;, which we can establish by proving big-O and big-&amp;amp;Omega; bounds separately (pumping &amp;quot;up&amp;quot; or &amp;quot;down&amp;quot; the values of the terms in the factorial and the overall number of terms as needed)&lt;br /&gt;
&lt;br /&gt;
=== Stirling&#039;s Approximation ===&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;\ln n! \sim n\ln n - n\ .&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Derivatives ===&lt;br /&gt;
d/dx a^f(x) = a^f(x) * d(f(x))/dx * ln(a)&lt;br /&gt;
&lt;br /&gt;
=== The Silicon Downs : Furlongs of Asymptotic Complexity ===&lt;br /&gt;
&lt;br /&gt;
&amp;quot;NEWS FLASH: Mounties Find Silicon Downs Fixed!&amp;quot;&lt;br /&gt;
* Constant &amp;lt;math&amp;gt; \in O(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Logarithmic &amp;lt;math&amp;gt; \in O(log n)&amp;lt;/math&amp;gt;   ie. &amp;lt;math&amp;gt;log_k n , log n^2 \in O(log n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Poly-Log &amp;lt;math&amp;gt; \in O(log^k n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Linear &amp;lt;math&amp;gt; \in O(n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Log-Linear &amp;lt;math&amp;gt; \in O(nlog n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Superlinear &amp;lt;math&amp;gt; \in O(n^{1+c})&amp;lt;/math&amp;gt; where: c is a constant &amp;gt; 0&lt;br /&gt;
* Quadratic &amp;lt;math&amp;gt; \in O(n^2)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Cubic &amp;lt;math&amp;gt; \in O(n^3)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Polynomial &amp;lt;math&amp;gt; \in O(n^k)&amp;lt;/math&amp;gt; where: k is a constant, &amp;quot;tractable&amp;quot;&lt;br /&gt;
* Exponential &amp;lt;math&amp;gt; \in O(c^n)&amp;lt;/math&amp;gt; where: c is a constant &amp;gt; 1, &amp;quot;intractable&amp;quot;&lt;/div&gt;</summary>
		<author><name>Niels</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC_320/Midterm_1_Reference_Sheet&amp;diff=19057</id>
		<title>Course:CPSC 320/Midterm 1 Reference Sheet</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC_320/Midterm_1_Reference_Sheet&amp;diff=19057"/>
		<updated>2010-02-02T02:15:52Z</updated>

		<summary type="html">&lt;p&gt;Niels: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== CPSC 320 2009W2 Exam Reference Sheet ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Do not remove:&#039;&#039;&#039; This reference sheet is the appendix for Midterm #1.  Only the first 4 printed pages will be used; so be compact!&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in O(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;\exist c \in \mathbf{R^+}, \exist n_0 \in \mathbf{Z^+}, \forall n \in \mathbf{Z^+}, n \geq n_0 \rightarrow f(n) \leq c g(n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in \Omega(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;g(n) \in O(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in \Theta(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;f(n) \in O(g(n))&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;g(n) \in O(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in o(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;\forall c \in \mathbf{R^+}, \exist n_0 \in \mathbf{Z^+}, \forall n \in \mathbf{Z^+}, n \geq n_0 \rightarrow f(n) &amp;lt; c g(n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in \omega(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;g(n) \in o(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also, if &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} =&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;f(n) \in \omega(g(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* a non-zero constant, then &amp;lt;math&amp;gt;f(n) \in \Theta(g(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;f(n) \in o(g(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(Plus bear in mind that (1) L&#039;Hopital&#039;s rule may be handy, and (2) the limit is not always well-defined!)&lt;br /&gt;
&lt;br /&gt;
L&#039;Hopital&#039;s Rule:&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} = \frac{0}{0}&amp;lt;/math&amp;gt;  or &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} = \frac{\infty}{\infty}&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} = \frac{f(n)&#039;}{g(n)&#039;}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Analogy to Inequalities ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = O(g(n)) if and only if g(n) = \Omega(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = o(g(n)) if and only if g(n) = \omega(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It follows, where &amp;lt;math&amp;gt;a \approx f(n)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;b \approx f(n)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = O(g(n)) \approx a \leq b&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = \Omega(g(n)) \approx a \geq b&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = \Theta(g(n)) \approx a = b&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = o(g(n)) \approx a &amp;lt; b&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = \omega(g(n)) \approx a &amp;gt; b&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Caution: For all &amp;lt;math&amp;gt;a, b, \in \mathbf{R}&amp;lt;/math&amp;gt; exactly one must hold: &amp;lt;math&amp;gt; a&amp;lt;b, a=b&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt; a&amp;gt;b &amp;lt;/math&amp;gt;.  Not all functions are asymptotically comparable.&lt;br /&gt;
&lt;br /&gt;
=== Master Theorem ===&lt;br /&gt;
If &amp;lt;math&amp;gt;\displaystyle T(n) = aT(&#039;&#039;n/b&#039;&#039;) + f(n)&amp;lt;/math&amp;gt; and a constant in the base case, where &amp;lt;math&amp;gt;&#039;&#039;n/b&#039;&#039;&amp;lt;/math&amp;gt; can be either &amp;lt;math&amp;gt;\lfloor n/b \rfloor&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;\lceil n/b \rceil&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt; a &amp;gt;= 1 &amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; b &amp;gt; 1 &amp;lt;/math&amp;gt; then:&lt;br /&gt;
* If &amp;lt;math&amp;gt;f(n) \in O(n^{log_b {a-\mathcal{E}}})&amp;lt;/math&amp;gt; for some &amp;lt;math&amp;gt;\mathcal{E} &amp;gt;0&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;T(n) \in \Theta(n^{log_b a})&amp;lt;/math&amp;gt;&lt;br /&gt;
** Dominated by leaf cost&lt;br /&gt;
* If &amp;lt;math&amp;gt;f(n) \in \Theta (n^{log_b a})&amp;lt;/math&amp;gt; then, &amp;lt;math&amp;gt;T(n) \in \Theta (n^{log_b a} lg n) &amp;lt;/math&amp;gt;&lt;br /&gt;
** Balanced cost&lt;br /&gt;
* If &amp;lt;math&amp;gt;f(n) \in \Omega(n^{log_b {a+\mathcal{E}}})&amp;lt;/math&amp;gt; for some &amp;lt;math&amp;gt;\mathcal{E} &amp;gt; 0&amp;lt;/math&amp;gt; and if &amp;lt;math&amp;gt;\displaystyle af(&#039;&#039;n/b&#039;&#039;) \leq cf(n)&amp;lt;/math&amp;gt; for some constant &amp;lt;math&amp;gt;\displaystyle c &amp;lt; 1&amp;lt;/math&amp;gt; and sufficiently large &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;T(n) \in \Theta(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
** Dominated by root cost&lt;br /&gt;
&lt;br /&gt;
The following equations cannot be solved using the master theorem:&amp;lt;ref&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 2^nT\left (\frac{n}{2}\right )+n^n&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&#039;&#039;a&#039;&#039; is not a constant&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 2T\left (\frac{n}{2}\right )+\frac{n}{\log n}&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;non-polynomial difference between f(n) and &amp;lt;math&amp;gt;n^{\log_b a}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 0.5T\left (\frac{n}{2}\right )+n&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&#039;&#039;a&#039;&#039;&amp;lt;1 cannot have less than one sub problem&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 64T\left (\frac{n}{8}\right )-n^2\log n&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;f(n) is not positive&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = T\left (\frac{n}{2}\right )+n(2-\cos n)&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;case 3 but regularity violation.&lt;br /&gt;
&lt;br /&gt;
Also, Case 3 always hold when f = n^k and If &amp;lt;math&amp;gt;f(n) \in \Omega(n^{log_b {a+\mathcal{E}}})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Log Laws ===&lt;br /&gt;
For all real a &amp;gt; 0, b &amp;gt; 0, c &amp;gt; 0, and n, &lt;br /&gt;
*&amp;lt;math&amp;gt;a = b^{\log_b a}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_c ab = \log_c a + \log_c b&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b a^n = n \log_b a&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b a = \frac{\log_c a}{\log_c b}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b \frac{1}{a} = -\log_b a&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b a = \frac{1}{\log_a b}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;a^{\log_b c} = c^{\log_b a}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Summation ===&lt;br /&gt;
*Arithmetic Series:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=1}^n(k) = 1 + 2 + \dots + n} = \frac{1}{2}n(n + 1)&amp;lt;/math&amp;gt;&lt;br /&gt;
*Sum of Squares:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^n(k^2)} = \frac{n(n+1)(2n+1)}{6}&amp;lt;/math&amp;gt;&lt;br /&gt;
*Sum of Cubes:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^n(k^3)} = \frac{n^2(n+1)^2}{4}&amp;lt;/math&amp;gt;&lt;br /&gt;
*Geometric Series:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^n(x^k) = 1 + x + x^2 + \dots + x^k} = \frac{x^{n + 1} - 1}{x -1 }, &amp;lt;/math&amp;gt; for real &amp;lt;math&amp;gt; x \ne 1&amp;lt;/math&amp;gt;&lt;br /&gt;
*Infinite decreasing: &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^{\infty}(x^k) = \frac{1}{ 1 - x }, for  |x| &amp;lt; 1 } &amp;lt;/math&amp;gt;&lt;br /&gt;
*Telescoping: &amp;lt;math&amp;gt; \displaystyle{\sum_{k=1}^{n-1}(a_{k} - a_{k +1}) = a_0 - a_n } &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Exponents===&lt;br /&gt;
* &amp;lt;math&amp;gt;a^0 = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a^1 = a&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a^{-1} = \frac{1}{a}&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;(a^m)^n = a^{mn}&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a^m \times a^n = a^{m+n}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Decision Tree-Related Notes ===&lt;br /&gt;
&lt;br /&gt;
* for a list of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; elements, there&#039;s &amp;lt;math&amp;gt;n!&amp;lt;/math&amp;gt; permutations&lt;br /&gt;
* a binary tree of height &amp;lt;math&amp;gt;d&amp;lt;/math&amp;gt; has at most &amp;lt;math&amp;gt;2^d&amp;lt;/math&amp;gt; leaves&lt;br /&gt;
* therefore, a binary tree with at least &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; leaves must have height at least &amp;lt;math&amp;gt;\lceil \lg n\rceil&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;\lg(n!) \in \Theta(n \lg n)&amp;lt;/math&amp;gt;, which we can establish by proving big-O and big-&amp;amp;Omega; bounds separately (pumping &amp;quot;up&amp;quot; or &amp;quot;down&amp;quot; the values of the terms in the factorial and the overall number of terms as needed)&lt;br /&gt;
&lt;br /&gt;
=== Stirling&#039;s Approximation ===&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;\ln n! \sim n\ln n - n\ .&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Derivatives ===&lt;br /&gt;
d/dx a^f(x) = a^f(x) * d(f(x))/dx * ln(a)&lt;br /&gt;
&lt;br /&gt;
=== The Silicon Downs : Furlongs of Asymptotic Complexity ===&lt;br /&gt;
&lt;br /&gt;
&amp;quot;NEWS FLASH: Mounties Find Silicon Downs Fixed!&amp;quot;&lt;br /&gt;
* Constant &amp;lt;math&amp;gt; \in O(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Logarithmic &amp;lt;math&amp;gt; \in O(log n)&amp;lt;/math&amp;gt;   ie. &amp;lt;math&amp;gt;log_k n , log n^2 \in O(log n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Poly-Log &amp;lt;math&amp;gt; \in O(log^k n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Linear &amp;lt;math&amp;gt; \in O(n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Log-Linear &amp;lt;math&amp;gt; \in O(nlog n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Superlinear &amp;lt;math&amp;gt; \in O(n^{1+c})&amp;lt;/math&amp;gt; where: c is a constant &amp;gt; 0&lt;br /&gt;
* Quadratic &amp;lt;math&amp;gt; \in O(n^2)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Cubic &amp;lt;math&amp;gt; \in O(n^3)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Polynomial &amp;lt;math&amp;gt; \in O(n^k)&amp;lt;/math&amp;gt; where: k is a constant, &amp;quot;tractable&amp;quot;&lt;br /&gt;
* Exponential &amp;lt;math&amp;gt; \in O(c^n)&amp;lt;/math&amp;gt; where: c is a constant &amp;gt; 1, &amp;quot;intractable&amp;quot;&lt;/div&gt;</summary>
		<author><name>Niels</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC_320/Midterm_1_Reference_Sheet&amp;diff=19056</id>
		<title>Course:CPSC 320/Midterm 1 Reference Sheet</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC_320/Midterm_1_Reference_Sheet&amp;diff=19056"/>
		<updated>2010-02-02T02:13:04Z</updated>

		<summary type="html">&lt;p&gt;Niels: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== CPSC 320 2009W2 Exam Reference Sheet ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Do not remove:&#039;&#039;&#039; This reference sheet is the appendix for Midterm #1.  Only the first 4 printed pages will be used; so be compact!&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in O(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;\exist c \in \mathbf{R^+}, \exist n_0 \in \mathbf{Z^+}, \forall n \in \mathbf{Z^+}, n \geq n_0 \rightarrow f(n) \leq c g(n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in \Omega(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;g(n) \in O(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in \Theta(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;f(n) \in O(g(n))&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;g(n) \in O(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in o(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;\forall c \in \mathbf{R^+}, \exist n_0 \in \mathbf{Z^+}, \forall n \in \mathbf{Z^+}, n \geq n_0 \rightarrow f(n) &amp;lt; c g(n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in \omega(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;g(n) \in o(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also, if &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} =&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;f(n) \in \omega(g(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* a non-zero constant, then &amp;lt;math&amp;gt;f(n) \in \Theta(g(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;f(n) \in o(g(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(Plus bear in mind that (1) L&#039;Hopital&#039;s rule may be handy, and (2) the limit is not always well-defined!)&lt;br /&gt;
&lt;br /&gt;
L&#039;Hopital&#039;s Rule:&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} = \frac{0}{0}&amp;lt;/math&amp;gt;  or &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} = \frac{\infty}{\infty}&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} = \frac{f(n)&#039;}{g(n)&#039;}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Analogy to Inequalities ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; f(n) = O(g(n)) if and only if g(n) = \Omega(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; f(n) = o(g(n)) if and only if g(n) = \omega(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It follows that:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = O(g(n)) \approx a \leq b&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = \Omega(g(n)) \approx a \geq b&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = \Theta(g(n)) \approx a = b&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = o(g(n)) \approx a &amp;lt; b&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; f(n) = \omega(g(n)) \approx a &amp;gt; b&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Caution: For all &amp;lt;math&amp;gt;a, b, \in \mathbf{R}&amp;lt;/math&amp;gt; exactly one must hold: &amp;lt;math&amp;gt; a&amp;lt;b, a=b&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt; a&amp;gt;b &amp;lt;/math&amp;gt;.  Not all functions are asymptotically comparable.&lt;br /&gt;
&lt;br /&gt;
=== Master Theorem ===&lt;br /&gt;
If &amp;lt;math&amp;gt;\displaystyle T(n) = aT(&#039;&#039;n/b&#039;&#039;) + f(n)&amp;lt;/math&amp;gt; and a constant in the base case, where &amp;lt;math&amp;gt;&#039;&#039;n/b&#039;&#039;&amp;lt;/math&amp;gt; can be either &amp;lt;math&amp;gt;\lfloor n/b \rfloor&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;\lceil n/b \rceil&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt; a &amp;gt;= 1 &amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; b &amp;gt; 1 &amp;lt;/math&amp;gt; then:&lt;br /&gt;
* If &amp;lt;math&amp;gt;f(n) \in O(n^{log_b {a-\mathcal{E}}})&amp;lt;/math&amp;gt; for some &amp;lt;math&amp;gt;\mathcal{E} &amp;gt;0&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;T(n) \in \Theta(n^{log_b a})&amp;lt;/math&amp;gt;&lt;br /&gt;
** Dominated by leaf cost&lt;br /&gt;
* If &amp;lt;math&amp;gt;f(n) \in \Theta (n^{log_b a})&amp;lt;/math&amp;gt; then, &amp;lt;math&amp;gt;T(n) \in \Theta (n^{log_b a} lg n) &amp;lt;/math&amp;gt;&lt;br /&gt;
** Balanced cost&lt;br /&gt;
* If &amp;lt;math&amp;gt;f(n) \in \Omega(n^{log_b {a+\mathcal{E}}})&amp;lt;/math&amp;gt; for some &amp;lt;math&amp;gt;\mathcal{E} &amp;gt; 0&amp;lt;/math&amp;gt; and if &amp;lt;math&amp;gt;\displaystyle af(&#039;&#039;n/b&#039;&#039;) \leq cf(n)&amp;lt;/math&amp;gt; for some constant &amp;lt;math&amp;gt;\displaystyle c &amp;lt; 1&amp;lt;/math&amp;gt; and sufficiently large &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;T(n) \in \Theta(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
** Dominated by root cost&lt;br /&gt;
&lt;br /&gt;
The following equations cannot be solved using the master theorem:&amp;lt;ref&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 2^nT\left (\frac{n}{2}\right )+n^n&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&#039;&#039;a&#039;&#039; is not a constant&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 2T\left (\frac{n}{2}\right )+\frac{n}{\log n}&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;non-polynomial difference between f(n) and &amp;lt;math&amp;gt;n^{\log_b a}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 0.5T\left (\frac{n}{2}\right )+n&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&#039;&#039;a&#039;&#039;&amp;lt;1 cannot have less than one sub problem&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 64T\left (\frac{n}{8}\right )-n^2\log n&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;f(n) is not positive&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = T\left (\frac{n}{2}\right )+n(2-\cos n)&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;case 3 but regularity violation.&lt;br /&gt;
&lt;br /&gt;
Also, Case 3 always hold when f = n^k and If &amp;lt;math&amp;gt;f(n) \in \Omega(n^{log_b {a+\mathcal{E}}})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Log Laws ===&lt;br /&gt;
For all real a &amp;gt; 0, b &amp;gt; 0, c &amp;gt; 0, and n, &lt;br /&gt;
*&amp;lt;math&amp;gt;a = b^{\log_b a}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_c ab = \log_c a + \log_c b&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b a^n = n \log_b a&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b a = \frac{\log_c a}{\log_c b}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b \frac{1}{a} = -\log_b a&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b a = \frac{1}{\log_a b}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;a^{\log_b c} = c^{\log_b a}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Summation ===&lt;br /&gt;
*Arithmetic Series:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=1}^n(k) = 1 + 2 + \dots + n} = \frac{1}{2}n(n + 1)&amp;lt;/math&amp;gt;&lt;br /&gt;
*Sum of Squares:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^n(k^2)} = \frac{n(n+1)(2n+1)}{6}&amp;lt;/math&amp;gt;&lt;br /&gt;
*Sum of Cubes:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^n(k^3)} = \frac{n^2(n+1)^2}{4}&amp;lt;/math&amp;gt;&lt;br /&gt;
*Geometric Series:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^n(x^k) = 1 + x + x^2 + \dots + x^k} = \frac{x^{n + 1} - 1}{x -1 }, &amp;lt;/math&amp;gt; for real &amp;lt;math&amp;gt; x \ne 1&amp;lt;/math&amp;gt;&lt;br /&gt;
*Infinite decreasing: &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^{\infty}(x^k) = \frac{1}{ 1 - x }, for  |x| &amp;lt; 1 } &amp;lt;/math&amp;gt;&lt;br /&gt;
*Telescoping: &amp;lt;math&amp;gt; \displaystyle{\sum_{k=1}^{n-1}(a_{k} - a_{k +1}) = a_0 - a_n } &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Exponents===&lt;br /&gt;
* &amp;lt;math&amp;gt;a^0 = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a^1 = a&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a^{-1} = \frac{1}{a}&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;(a^m)^n = a^{mn}&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a^m \times a^n = a^{m+n}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Decision Tree-Related Notes ===&lt;br /&gt;
&lt;br /&gt;
* for a list of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; elements, there&#039;s &amp;lt;math&amp;gt;n!&amp;lt;/math&amp;gt; permutations&lt;br /&gt;
* a binary tree of height &amp;lt;math&amp;gt;d&amp;lt;/math&amp;gt; has at most &amp;lt;math&amp;gt;2^d&amp;lt;/math&amp;gt; leaves&lt;br /&gt;
* therefore, a binary tree with at least &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; leaves must have height at least &amp;lt;math&amp;gt;\lceil \lg n\rceil&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;\lg(n!) \in \Theta(n \lg n)&amp;lt;/math&amp;gt;, which we can establish by proving big-O and big-&amp;amp;Omega; bounds separately (pumping &amp;quot;up&amp;quot; or &amp;quot;down&amp;quot; the values of the terms in the factorial and the overall number of terms as needed)&lt;br /&gt;
&lt;br /&gt;
=== Stirling&#039;s Approximation ===&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;\ln n! \sim n\ln n - n\ .&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Derivatives ===&lt;br /&gt;
d/dx a^f(x) = a^f(x) * d(f(x))/dx * ln(a)&lt;br /&gt;
&lt;br /&gt;
=== The Silicon Downs : Furlongs of Asymptotic Complexity ===&lt;br /&gt;
&lt;br /&gt;
&amp;quot;NEWS FLASH: Mounties Find Silicon Downs Fixed!&amp;quot;&lt;br /&gt;
* Constant &amp;lt;math&amp;gt; \in O(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Logarithmic &amp;lt;math&amp;gt; \in O(log n)&amp;lt;/math&amp;gt;   ie. &amp;lt;math&amp;gt;log_k n , log n^2 \in O(log n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Poly-Log &amp;lt;math&amp;gt; \in O(log^k n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Linear &amp;lt;math&amp;gt; \in O(n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Log-Linear &amp;lt;math&amp;gt; \in O(nlog n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Superlinear &amp;lt;math&amp;gt; \in O(n^{1+c})&amp;lt;/math&amp;gt; where: c is a constant &amp;gt; 0&lt;br /&gt;
* Quadratic &amp;lt;math&amp;gt; \in O(n^2)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Cubic &amp;lt;math&amp;gt; \in O(n^3)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Polynomial &amp;lt;math&amp;gt; \in O(n^k)&amp;lt;/math&amp;gt; where: k is a constant, &amp;quot;tractable&amp;quot;&lt;br /&gt;
* Exponential &amp;lt;math&amp;gt; \in O(c^n)&amp;lt;/math&amp;gt; where: c is a constant &amp;gt; 1, &amp;quot;intractable&amp;quot;&lt;/div&gt;</summary>
		<author><name>Niels</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC_320/Midterm_1_Reference_Sheet&amp;diff=19055</id>
		<title>Course:CPSC 320/Midterm 1 Reference Sheet</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC_320/Midterm_1_Reference_Sheet&amp;diff=19055"/>
		<updated>2010-02-02T01:09:42Z</updated>

		<summary type="html">&lt;p&gt;Niels: /* The Silicon Downs : Furlongs of Asymptotic Complexity */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== CPSC 320 2009W2 Exam Reference Sheet ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Do not remove:&#039;&#039;&#039; This reference sheet is the appendix for Midterm #1.  Only the first 4 printed pages will be used; so be compact!&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in O(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;\exist c \in \mathbf{R^+}, \exist n_0 \in \mathbf{Z^+}, \forall n \in \mathbf{Z^+}, n \geq n_0 \rightarrow f(n) \leq c g(n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in \Omega(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;g(n) \in O(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in \Theta(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;f(n) \in O(g(n))&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;g(n) \in O(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in o(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;\forall c \in \mathbf{R^+}, \exist n_0 \in \mathbf{Z^+}, \forall n \in \mathbf{Z^+}, n \geq n_0 \rightarrow f(n) &amp;lt; c g(n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in \omega(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;g(n) \in o(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also, if &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} =&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;f(n) \in \omega(g(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* a non-zero constant, then &amp;lt;math&amp;gt;f(n) \in \Theta(g(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;f(n) \in o(g(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(Plus bear in mind that (1) L&#039;Hopital&#039;s rule may be handy, and (2) the limit is not always well-defined!)&lt;br /&gt;
&lt;br /&gt;
L&#039;Hopital&#039;s Rule:&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} = \frac{0}{0}&amp;lt;/math&amp;gt;  or &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} = \frac{\infty}{\infty}&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} = \frac{f(n)&#039;}{g(n)&#039;}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Master Theorem ===&lt;br /&gt;
If &amp;lt;math&amp;gt;\displaystyle T(n) = aT(&#039;&#039;n/b&#039;&#039;) + f(n)&amp;lt;/math&amp;gt; and a constant in the base case, where &amp;lt;math&amp;gt;&#039;&#039;n/b&#039;&#039;&amp;lt;/math&amp;gt; can be either &amp;lt;math&amp;gt;\lfloor n/b \rfloor&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;\lceil n/b \rceil&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt; a &amp;gt;= 1 &amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; b &amp;gt; 1 &amp;lt;/math&amp;gt; then:&lt;br /&gt;
* If &amp;lt;math&amp;gt;f(n) \in O(n^{log_b {a-\mathcal{E}}})&amp;lt;/math&amp;gt; for some &amp;lt;math&amp;gt;\mathcal{E} &amp;gt;0&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;T(n) \in \Theta(n^{log_b a})&amp;lt;/math&amp;gt;&lt;br /&gt;
** Dominated by leaf cost&lt;br /&gt;
* If &amp;lt;math&amp;gt;f(n) \in \Theta (n^{log_b a})&amp;lt;/math&amp;gt; then, &amp;lt;math&amp;gt;T(n) \in \Theta (n^{log_b a} lg n) &amp;lt;/math&amp;gt;&lt;br /&gt;
** Balanced cost&lt;br /&gt;
* If &amp;lt;math&amp;gt;f(n) \in \Omega(n^{log_b {a+\mathcal{E}}})&amp;lt;/math&amp;gt; for some &amp;lt;math&amp;gt;\mathcal{E} &amp;gt; 0&amp;lt;/math&amp;gt; and if &amp;lt;math&amp;gt;\displaystyle af(&#039;&#039;n/b&#039;&#039;) \leq cf(n)&amp;lt;/math&amp;gt; for some constant &amp;lt;math&amp;gt;\displaystyle c &amp;lt; 1&amp;lt;/math&amp;gt; and sufficiently large &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;T(n) \in \Theta(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
** Dominated by root cost&lt;br /&gt;
&lt;br /&gt;
The following equations cannot be solved using the master theorem:&amp;lt;ref&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 2^nT\left (\frac{n}{2}\right )+n^n&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&#039;&#039;a&#039;&#039; is not a constant&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 2T\left (\frac{n}{2}\right )+\frac{n}{\log n}&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;non-polynomial difference between f(n) and &amp;lt;math&amp;gt;n^{\log_b a}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 0.5T\left (\frac{n}{2}\right )+n&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&#039;&#039;a&#039;&#039;&amp;lt;1 cannot have less than one sub problem&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 64T\left (\frac{n}{8}\right )-n^2\log n&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;f(n) is not positive&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = T\left (\frac{n}{2}\right )+n(2-\cos n)&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;case 3 but regularity violation.&lt;br /&gt;
&lt;br /&gt;
Also, Case 3 always hold when f = n^k and If &amp;lt;math&amp;gt;f(n) \in \Omega(n^{log_b {a+\mathcal{E}}})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Log Laws ===&lt;br /&gt;
For all real a &amp;gt; 0, b &amp;gt; 0, c &amp;gt; 0, and n, &lt;br /&gt;
*&amp;lt;math&amp;gt;a = b^{\log_b a}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_c ab = \log_c a + \log_c b&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b a^n = n \log_b a&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b a = \frac{\log_c a}{\log_c b}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b \frac{1}{a} = -\log_b a&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b a = \frac{1}{\log_a b}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;a^{\log_b c} = c^{\log_b a}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Summation ===&lt;br /&gt;
*Arithmetic Series:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=1}^n(k) = 1 + 2 + \dots + n} = \frac{1}{2}n(n + 1)&amp;lt;/math&amp;gt;&lt;br /&gt;
*Sum of Squares:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^n(k^2)} = \frac{n(n+1)(2n+1)}{6}&amp;lt;/math&amp;gt;&lt;br /&gt;
*Sum of Cubes:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^n(k^3)} = \frac{n^2(n+1)^2}{4}&amp;lt;/math&amp;gt;&lt;br /&gt;
*Geometric Series:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^n(x^k) = 1 + x + x^2 + \dots + x^k} = \frac{x^{n + 1} - 1}{x -1 }, &amp;lt;/math&amp;gt; for real &amp;lt;math&amp;gt; x \ne 1&amp;lt;/math&amp;gt;&lt;br /&gt;
*Infinite decreasing: &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^{\infty}(x^k) = \frac{1}{ 1 - x }, for  |x| &amp;lt; 1 } &amp;lt;/math&amp;gt;&lt;br /&gt;
*Telescoping: &amp;lt;math&amp;gt; \displaystyle{\sum_{k=1}^{n-1}(a_{k} - a_{k +1}) = a_0 - a_n } &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Exponents===&lt;br /&gt;
* &amp;lt;math&amp;gt;a^0 = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a^1 = a&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a^{-1} = \frac{1}{a}&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;(a^m)^n = a^{mn}&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a^m \times a^n = a^{m+n}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Decision Tree-Related Notes ===&lt;br /&gt;
&lt;br /&gt;
* for a list of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; elements, there&#039;s &amp;lt;math&amp;gt;n!&amp;lt;/math&amp;gt; permutations&lt;br /&gt;
* a binary tree of height &amp;lt;math&amp;gt;d&amp;lt;/math&amp;gt; has at most &amp;lt;math&amp;gt;2^d&amp;lt;/math&amp;gt; leaves&lt;br /&gt;
* therefore, a binary tree with at least &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; leaves must have height at least &amp;lt;math&amp;gt;\lceil \lg n\rceil&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;\lg(n!) \in \Theta(n \lg n)&amp;lt;/math&amp;gt;, which we can establish by proving big-O and big-&amp;amp;Omega; bounds separately (pumping &amp;quot;up&amp;quot; or &amp;quot;down&amp;quot; the values of the terms in the factorial and the overall number of terms as needed)&lt;br /&gt;
&lt;br /&gt;
=== Stirling&#039;s Approximation ===&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;\ln n! \sim n\ln n - n\ .&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Derivatives ===&lt;br /&gt;
d/dx a^f(x) = a^f(x) * d(f(x))/dx * ln(a)&lt;br /&gt;
&lt;br /&gt;
=== The Silicon Downs : Furlongs of Asymptotic Complexity ===&lt;br /&gt;
&lt;br /&gt;
&amp;quot;NEWS FLASH: Mounties Find Silicon Downs Fixed!&amp;quot;&lt;br /&gt;
* Constant &amp;lt;math&amp;gt; \in O(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Logarithmic &amp;lt;math&amp;gt; \in O(log n)&amp;lt;/math&amp;gt;   ie. &amp;lt;math&amp;gt;log_k n , log n^2 \in O(log n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Poly-Log &amp;lt;math&amp;gt; \in O(log^k n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Linear &amp;lt;math&amp;gt; \in O(n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Log-Linear &amp;lt;math&amp;gt; \in O(nlog n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Superlinear &amp;lt;math&amp;gt; \in O(n^{1+c})&amp;lt;/math&amp;gt; where: c is a constant &amp;gt; 0&lt;br /&gt;
* Quadratic &amp;lt;math&amp;gt; \in O(n^2)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Cubic &amp;lt;math&amp;gt; \in O(n^3)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Polynomial &amp;lt;math&amp;gt; \in O(n^k)&amp;lt;/math&amp;gt; where: k is a constant, &amp;quot;tractable&amp;quot;&lt;br /&gt;
* Exponential &amp;lt;math&amp;gt; \in O(c^n)&amp;lt;/math&amp;gt; where: c is a constant &amp;gt; 1, &amp;quot;intractable&amp;quot;&lt;/div&gt;</summary>
		<author><name>Niels</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC_320/Midterm_1_Reference_Sheet&amp;diff=19054</id>
		<title>Course:CPSC 320/Midterm 1 Reference Sheet</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC_320/Midterm_1_Reference_Sheet&amp;diff=19054"/>
		<updated>2010-02-02T01:08:35Z</updated>

		<summary type="html">&lt;p&gt;Niels: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== CPSC 320 2009W2 Exam Reference Sheet ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Do not remove:&#039;&#039;&#039; This reference sheet is the appendix for Midterm #1.  Only the first 4 printed pages will be used; so be compact!&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in O(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;\exist c \in \mathbf{R^+}, \exist n_0 \in \mathbf{Z^+}, \forall n \in \mathbf{Z^+}, n \geq n_0 \rightarrow f(n) \leq c g(n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in \Omega(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;g(n) \in O(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in \Theta(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;f(n) \in O(g(n))&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;g(n) \in O(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in o(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;\forall c \in \mathbf{R^+}, \exist n_0 \in \mathbf{Z^+}, \forall n \in \mathbf{Z^+}, n \geq n_0 \rightarrow f(n) &amp;lt; c g(n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in \omega(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;g(n) \in o(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also, if &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} =&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;f(n) \in \omega(g(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* a non-zero constant, then &amp;lt;math&amp;gt;f(n) \in \Theta(g(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;f(n) \in o(g(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(Plus bear in mind that (1) L&#039;Hopital&#039;s rule may be handy, and (2) the limit is not always well-defined!)&lt;br /&gt;
&lt;br /&gt;
L&#039;Hopital&#039;s Rule:&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} = \frac{0}{0}&amp;lt;/math&amp;gt;  or &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} = \frac{\infty}{\infty}&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} = \frac{f(n)&#039;}{g(n)&#039;}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Master Theorem ===&lt;br /&gt;
If &amp;lt;math&amp;gt;\displaystyle T(n) = aT(&#039;&#039;n/b&#039;&#039;) + f(n)&amp;lt;/math&amp;gt; and a constant in the base case, where &amp;lt;math&amp;gt;&#039;&#039;n/b&#039;&#039;&amp;lt;/math&amp;gt; can be either &amp;lt;math&amp;gt;\lfloor n/b \rfloor&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;\lceil n/b \rceil&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt; a &amp;gt;= 1 &amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; b &amp;gt; 1 &amp;lt;/math&amp;gt; then:&lt;br /&gt;
* If &amp;lt;math&amp;gt;f(n) \in O(n^{log_b {a-\mathcal{E}}})&amp;lt;/math&amp;gt; for some &amp;lt;math&amp;gt;\mathcal{E} &amp;gt;0&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;T(n) \in \Theta(n^{log_b a})&amp;lt;/math&amp;gt;&lt;br /&gt;
** Dominated by leaf cost&lt;br /&gt;
* If &amp;lt;math&amp;gt;f(n) \in \Theta (n^{log_b a})&amp;lt;/math&amp;gt; then, &amp;lt;math&amp;gt;T(n) \in \Theta (n^{log_b a} lg n) &amp;lt;/math&amp;gt;&lt;br /&gt;
** Balanced cost&lt;br /&gt;
* If &amp;lt;math&amp;gt;f(n) \in \Omega(n^{log_b {a+\mathcal{E}}})&amp;lt;/math&amp;gt; for some &amp;lt;math&amp;gt;\mathcal{E} &amp;gt; 0&amp;lt;/math&amp;gt; and if &amp;lt;math&amp;gt;\displaystyle af(&#039;&#039;n/b&#039;&#039;) \leq cf(n)&amp;lt;/math&amp;gt; for some constant &amp;lt;math&amp;gt;\displaystyle c &amp;lt; 1&amp;lt;/math&amp;gt; and sufficiently large &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;T(n) \in \Theta(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
** Dominated by root cost&lt;br /&gt;
&lt;br /&gt;
The following equations cannot be solved using the master theorem:&amp;lt;ref&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 2^nT\left (\frac{n}{2}\right )+n^n&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&#039;&#039;a&#039;&#039; is not a constant&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 2T\left (\frac{n}{2}\right )+\frac{n}{\log n}&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;non-polynomial difference between f(n) and &amp;lt;math&amp;gt;n^{\log_b a}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 0.5T\left (\frac{n}{2}\right )+n&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&#039;&#039;a&#039;&#039;&amp;lt;1 cannot have less than one sub problem&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 64T\left (\frac{n}{8}\right )-n^2\log n&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;f(n) is not positive&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = T\left (\frac{n}{2}\right )+n(2-\cos n)&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;case 3 but regularity violation.&lt;br /&gt;
&lt;br /&gt;
Also, Case 3 always hold when f = n^k and If &amp;lt;math&amp;gt;f(n) \in \Omega(n^{log_b {a+\mathcal{E}}})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Log Laws ===&lt;br /&gt;
For all real a &amp;gt; 0, b &amp;gt; 0, c &amp;gt; 0, and n, &lt;br /&gt;
*&amp;lt;math&amp;gt;a = b^{\log_b a}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_c ab = \log_c a + \log_c b&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b a^n = n \log_b a&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b a = \frac{\log_c a}{\log_c b}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b \frac{1}{a} = -\log_b a&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b a = \frac{1}{\log_a b}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;a^{\log_b c} = c^{\log_b a}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Summation ===&lt;br /&gt;
*Arithmetic Series:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=1}^n(k) = 1 + 2 + \dots + n} = \frac{1}{2}n(n + 1)&amp;lt;/math&amp;gt;&lt;br /&gt;
*Sum of Squares:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^n(k^2)} = \frac{n(n+1)(2n+1)}{6}&amp;lt;/math&amp;gt;&lt;br /&gt;
*Sum of Cubes:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^n(k^3)} = \frac{n^2(n+1)^2}{4}&amp;lt;/math&amp;gt;&lt;br /&gt;
*Geometric Series:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^n(x^k) = 1 + x + x^2 + \dots + x^k} = \frac{x^{n + 1} - 1}{x -1 }, &amp;lt;/math&amp;gt; for real &amp;lt;math&amp;gt; x \ne 1&amp;lt;/math&amp;gt;&lt;br /&gt;
*Infinite decreasing: &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^{\infty}(x^k) = \frac{1}{ 1 - x }, for  |x| &amp;lt; 1 } &amp;lt;/math&amp;gt;&lt;br /&gt;
*Telescoping: &amp;lt;math&amp;gt; \displaystyle{\sum_{k=1}^{n-1}(a_{k} - a_{k +1}) = a_0 - a_n } &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Exponents===&lt;br /&gt;
* &amp;lt;math&amp;gt;a^0 = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a^1 = a&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a^{-1} = \frac{1}{a}&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;(a^m)^n = a^{mn}&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a^m \times a^n = a^{m+n}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Decision Tree-Related Notes ===&lt;br /&gt;
&lt;br /&gt;
* for a list of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; elements, there&#039;s &amp;lt;math&amp;gt;n!&amp;lt;/math&amp;gt; permutations&lt;br /&gt;
* a binary tree of height &amp;lt;math&amp;gt;d&amp;lt;/math&amp;gt; has at most &amp;lt;math&amp;gt;2^d&amp;lt;/math&amp;gt; leaves&lt;br /&gt;
* therefore, a binary tree with at least &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; leaves must have height at least &amp;lt;math&amp;gt;\lceil \lg n\rceil&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;\lg(n!) \in \Theta(n \lg n)&amp;lt;/math&amp;gt;, which we can establish by proving big-O and big-&amp;amp;Omega; bounds separately (pumping &amp;quot;up&amp;quot; or &amp;quot;down&amp;quot; the values of the terms in the factorial and the overall number of terms as needed)&lt;br /&gt;
&lt;br /&gt;
=== Stirling&#039;s Approximation ===&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;\ln n! \sim n\ln n - n\ .&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Derivatives ===&lt;br /&gt;
d/dx a^f(x) = a^f(x) * d(f(x))/dx * ln(a)&lt;br /&gt;
&lt;br /&gt;
=== The Silicon Downs : Furlongs of Asymptotic Complexity ===&lt;br /&gt;
&lt;br /&gt;
&amp;quot;NEWS FLASH: Mounties Find Silicon Downs Fixed!&amp;quot;&lt;br /&gt;
* Constant &amp;lt;math&amp;gt; \in O(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Logarithmic &amp;lt;math&amp;gt; \in O(log n)&amp;lt;/math&amp;gt;   ie. &amp;lt;math&amp;gt;log_k n , log n^2 \in O(log n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Poly-Log &amp;lt;math&amp;gt; \in O(log^k n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Linear &amp;lt;math&amp;gt; \in O(n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Log-Linear &amp;lt;math&amp;gt; \in O(n log n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Superlinear &amp;lt;math&amp;gt; \in O(n^{1+c})&amp;lt;/math&amp;gt; where: c is a constant &amp;gt; 0&lt;br /&gt;
* Quadratic &amp;lt;math&amp;gt; \in O(n^2)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Cubic &amp;lt;math&amp;gt; \in O(n^3)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Polynomial &amp;lt;math&amp;gt; \in O(n^k)&amp;lt;/math&amp;gt; where: k is a constant, &amp;quot;tractable&amp;quot;&lt;br /&gt;
* Exponential &amp;lt;math&amp;gt; \in O(c^n)&amp;lt;/math&amp;gt; where: c is a constant &amp;gt; 1, &amp;quot;intractable&amp;quot;&lt;/div&gt;</summary>
		<author><name>Niels</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC_320/Midterm_1_Reference_Sheet&amp;diff=19053</id>
		<title>Course:CPSC 320/Midterm 1 Reference Sheet</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC_320/Midterm_1_Reference_Sheet&amp;diff=19053"/>
		<updated>2010-02-02T01:07:59Z</updated>

		<summary type="html">&lt;p&gt;Niels: /* The Silicon Downs : Furlongs of Asymptotic Complexity */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== CPSC 320 2009W2 Exam Reference Sheet ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Do not remove:&#039;&#039;&#039; This reference sheet is the appendix for Midterm #1.  Only the first 4 printed pages will be used; so be compact!&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in O(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;\exist c \in \mathbf{R^+}, \exist n_0 \in \mathbf{Z^+}, \forall n \in \mathbf{Z^+}, n \geq n_0 \rightarrow f(n) \leq c g(n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in \Omega(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;g(n) \in O(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in \Theta(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;f(n) \in O(g(n))&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;g(n) \in O(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in o(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;\forall c \in \mathbf{R^+}, \exist n_0 \in \mathbf{Z^+}, \forall n \in \mathbf{Z^+}, n \geq n_0 \rightarrow f(n) &amp;lt; c g(n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in \omega(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;g(n) \in o(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also, if &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} =&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;f(n) \in \omega(g(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* a non-zero constant, then &amp;lt;math&amp;gt;f(n) \in \Theta(g(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;f(n) \in o(g(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(Plus bear in mind that (1) L&#039;Hopital&#039;s rule may be handy, and (2) the limit is not always well-defined!)&lt;br /&gt;
&lt;br /&gt;
L&#039;Hopital&#039;s Rule:&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} = \frac{0}{0}&amp;lt;/math&amp;gt;  or &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} = \frac{\infty}{\infty}&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} = \frac{f(n)&#039;}{g(n)&#039;}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Master Theorem ===&lt;br /&gt;
If &amp;lt;math&amp;gt;\displaystyle T(n) = aT(&#039;&#039;n/b&#039;&#039;) + f(n)&amp;lt;/math&amp;gt; and a constant in the base case, where &amp;lt;math&amp;gt;&#039;&#039;n/b&#039;&#039;&amp;lt;/math&amp;gt; can be either &amp;lt;math&amp;gt;\lfloor n/b \rfloor&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;\lceil n/b \rceil&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt; a &amp;gt;= 1 &amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; b &amp;gt; 1 &amp;lt;/math&amp;gt; then:&lt;br /&gt;
* If &amp;lt;math&amp;gt;f(n) \in O(n^{log_b {a-\mathcal{E}}})&amp;lt;/math&amp;gt; for some &amp;lt;math&amp;gt;\mathcal{E} &amp;gt;0&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;T(n) \in \Theta(n^{log_b a})&amp;lt;/math&amp;gt;&lt;br /&gt;
** Dominated by leaf cost&lt;br /&gt;
* If &amp;lt;math&amp;gt;f(n) \in \Theta (n^{log_b a})&amp;lt;/math&amp;gt; then, &amp;lt;math&amp;gt;T(n) \in \Theta (n^{log_b a} lg n) &amp;lt;/math&amp;gt;&lt;br /&gt;
** Balanced cost&lt;br /&gt;
* If &amp;lt;math&amp;gt;f(n) \in \Omega(n^{log_b {a+\mathcal{E}}})&amp;lt;/math&amp;gt; for some &amp;lt;math&amp;gt;\mathcal{E} &amp;gt; 0&amp;lt;/math&amp;gt; and if &amp;lt;math&amp;gt;\displaystyle af(&#039;&#039;n/b&#039;&#039;) \leq cf(n)&amp;lt;/math&amp;gt; for some constant &amp;lt;math&amp;gt;\displaystyle c &amp;lt; 1&amp;lt;/math&amp;gt; and sufficiently large &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;T(n) \in \Theta(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
** Dominated by root cost&lt;br /&gt;
&lt;br /&gt;
The following equations cannot be solved using the master theorem:&amp;lt;ref&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 2^nT\left (\frac{n}{2}\right )+n^n&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&#039;&#039;a&#039;&#039; is not a constant&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 2T\left (\frac{n}{2}\right )+\frac{n}{\log n}&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;non-polynomial difference between f(n) and &amp;lt;math&amp;gt;n^{\log_b a}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 0.5T\left (\frac{n}{2}\right )+n&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&#039;&#039;a&#039;&#039;&amp;lt;1 cannot have less than one sub problem&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 64T\left (\frac{n}{8}\right )-n^2\log n&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;f(n) is not positive&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = T\left (\frac{n}{2}\right )+n(2-\cos n)&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;case 3 but regularity violation.&lt;br /&gt;
&lt;br /&gt;
Also, Case 3 always hold when f = n^k and If &amp;lt;math&amp;gt;f(n) \in \Omega(n^{log_b {a+\mathcal{E}}})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Log Laws ===&lt;br /&gt;
For all real a &amp;gt; 0, b &amp;gt; 0, c &amp;gt; 0, and n, &lt;br /&gt;
*&amp;lt;math&amp;gt;a = b^{\log_b a}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_c ab = \log_c a + \log_c b&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b a^n = n \log_b a&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b a = \frac{\log_c a}{\log_c b}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b \frac{1}{a} = -\log_b a&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b a = \frac{1}{\log_a b}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;a^{\log_b c} = c^{\log_b a}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Summation ===&lt;br /&gt;
*Arithmetic Series:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=1}^n(k) = 1 + 2 + \dots + n} = \frac{1}{2}n(n + 1)&amp;lt;/math&amp;gt;&lt;br /&gt;
*Sum of Squares:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^n(k^2)} = \frac{n(n+1)(2n+1)}{6}&amp;lt;/math&amp;gt;&lt;br /&gt;
*Sum of Cubes:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^n(k^3)} = \frac{n^2(n+1)^2}{4}&amp;lt;/math&amp;gt;&lt;br /&gt;
*Geometric Series:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^n(x^k) = 1 + x + x^2 + \dots + x^k} = \frac{x^{n + 1} - 1}{x -1 }, &amp;lt;/math&amp;gt; for real &amp;lt;math&amp;gt; x \ne 1&amp;lt;/math&amp;gt;&lt;br /&gt;
*Infinite decreasing: &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^{\infty}(x^k) = \frac{1}{ 1 - x }, for  |x| &amp;lt; 1 } &amp;lt;/math&amp;gt;&lt;br /&gt;
*Telescoping: &amp;lt;math&amp;gt; \displaystyle{\sum_{k=1}^{n-1}(a_{k} - a_{k +1}) = a_0 - a_n } &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Exponents===&lt;br /&gt;
* &amp;lt;math&amp;gt;a^0 = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a^1 = a&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a^{-1} = \frac{1}{a}&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;(a^m)^n = a^{mn}&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a^m \times a^n = a^{m+n}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Decision Tree-Related Notes ===&lt;br /&gt;
&lt;br /&gt;
* for a list of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; elements, there&#039;s &amp;lt;math&amp;gt;n!&amp;lt;/math&amp;gt; permutations&lt;br /&gt;
* a binary tree of height &amp;lt;math&amp;gt;d&amp;lt;/math&amp;gt; has at most &amp;lt;math&amp;gt;2^d&amp;lt;/math&amp;gt; leaves&lt;br /&gt;
* therefore, a binary tree with at least &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; leaves must have height at least &amp;lt;math&amp;gt;\lceil \lg n\rceil&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;\lg(n!) \in \Theta(n \lg n)&amp;lt;/math&amp;gt;, which we can establish by proving big-O and big-&amp;amp;Omega; bounds separately (pumping &amp;quot;up&amp;quot; or &amp;quot;down&amp;quot; the values of the terms in the factorial and the overall number of terms as needed)&lt;br /&gt;
&lt;br /&gt;
=== Stirling&#039;s Approximation ===&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;\ln n! \sim n\ln n - n\ .&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Derivatives ===&lt;br /&gt;
d/dx a^f(x) = a^f(x) * d(f(x))/dx * ln(a)&lt;br /&gt;
&lt;br /&gt;
=== The Silicon Downs : Furlongs of Asymptotic Complexity ===&lt;br /&gt;
&lt;br /&gt;
&amp;quot;NEWS FLASH: Mounties Find Silicon Downs Fixed!&amp;quot;&lt;br /&gt;
* Constant &amp;lt;math&amp;gt; \in O(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Logarithmic &amp;lt;math&amp;gt; \in O(log n)&amp;lt;/math&amp;gt;   ie. &amp;lt;math&amp;gt;log_k n , log n^2 \in O(log n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Poly-Log &amp;lt;math&amp;gt; \in O(log^k n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Linear &amp;lt;math&amp;gt; \in O(n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Log-Linear &amp;lt;math&amp;gt; \in O(n log n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Superlinear &amp;lt;math&amp;gt; \in O(n^[1+c])&amp;lt;/math&amp;gt; where: c is a constant &amp;gt; 0&lt;br /&gt;
* Quadratic &amp;lt;math&amp;gt; \in O(n^2)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Cubic &amp;lt;math&amp;gt; \in O(n^3)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Polynomial &amp;lt;math&amp;gt; \in O(n^k)&amp;lt;/math&amp;gt; where: k is a constant, &amp;quot;tractable&amp;quot;&lt;br /&gt;
* Exponential &amp;lt;math&amp;gt; \in O(c^n)&amp;lt;/math&amp;gt; where: c is a constant &amp;gt; 1, &amp;quot;intractable&amp;quot;&lt;/div&gt;</summary>
		<author><name>Niels</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC_320/Midterm_1_Reference_Sheet&amp;diff=19052</id>
		<title>Course:CPSC 320/Midterm 1 Reference Sheet</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC_320/Midterm_1_Reference_Sheet&amp;diff=19052"/>
		<updated>2010-02-02T01:04:11Z</updated>

		<summary type="html">&lt;p&gt;Niels: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== CPSC 320 2009W2 Exam Reference Sheet ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Do not remove:&#039;&#039;&#039; This reference sheet is the appendix for Midterm #1.  Only the first 4 printed pages will be used; so be compact!&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in O(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;\exist c \in \mathbf{R^+}, \exist n_0 \in \mathbf{Z^+}, \forall n \in \mathbf{Z^+}, n \geq n_0 \rightarrow f(n) \leq c g(n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in \Omega(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;g(n) \in O(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in \Theta(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;f(n) \in O(g(n))&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;g(n) \in O(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in o(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;\forall c \in \mathbf{R^+}, \exist n_0 \in \mathbf{Z^+}, \forall n \in \mathbf{Z^+}, n \geq n_0 \rightarrow f(n) &amp;lt; c g(n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in \omega(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;g(n) \in o(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also, if &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} =&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;f(n) \in \omega(g(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* a non-zero constant, then &amp;lt;math&amp;gt;f(n) \in \Theta(g(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;f(n) \in o(g(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(Plus bear in mind that (1) L&#039;Hopital&#039;s rule may be handy, and (2) the limit is not always well-defined!)&lt;br /&gt;
&lt;br /&gt;
L&#039;Hopital&#039;s Rule:&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} = \frac{0}{0}&amp;lt;/math&amp;gt;  or &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} = \frac{\infty}{\infty}&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} = \frac{f(n)&#039;}{g(n)&#039;}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Master Theorem ===&lt;br /&gt;
If &amp;lt;math&amp;gt;\displaystyle T(n) = aT(&#039;&#039;n/b&#039;&#039;) + f(n)&amp;lt;/math&amp;gt; and a constant in the base case, where &amp;lt;math&amp;gt;&#039;&#039;n/b&#039;&#039;&amp;lt;/math&amp;gt; can be either &amp;lt;math&amp;gt;\lfloor n/b \rfloor&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;\lceil n/b \rceil&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt; a &amp;gt;= 1 &amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; b &amp;gt; 1 &amp;lt;/math&amp;gt; then:&lt;br /&gt;
* If &amp;lt;math&amp;gt;f(n) \in O(n^{log_b {a-\mathcal{E}}})&amp;lt;/math&amp;gt; for some &amp;lt;math&amp;gt;\mathcal{E} &amp;gt;0&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;T(n) \in \Theta(n^{log_b a})&amp;lt;/math&amp;gt;&lt;br /&gt;
** Dominated by leaf cost&lt;br /&gt;
* If &amp;lt;math&amp;gt;f(n) \in \Theta (n^{log_b a})&amp;lt;/math&amp;gt; then, &amp;lt;math&amp;gt;T(n) \in \Theta (n^{log_b a} lg n) &amp;lt;/math&amp;gt;&lt;br /&gt;
** Balanced cost&lt;br /&gt;
* If &amp;lt;math&amp;gt;f(n) \in \Omega(n^{log_b {a+\mathcal{E}}})&amp;lt;/math&amp;gt; for some &amp;lt;math&amp;gt;\mathcal{E} &amp;gt; 0&amp;lt;/math&amp;gt; and if &amp;lt;math&amp;gt;\displaystyle af(&#039;&#039;n/b&#039;&#039;) \leq cf(n)&amp;lt;/math&amp;gt; for some constant &amp;lt;math&amp;gt;\displaystyle c &amp;lt; 1&amp;lt;/math&amp;gt; and sufficiently large &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;T(n) \in \Theta(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
** Dominated by root cost&lt;br /&gt;
&lt;br /&gt;
The following equations cannot be solved using the master theorem:&amp;lt;ref&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 2^nT\left (\frac{n}{2}\right )+n^n&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&#039;&#039;a&#039;&#039; is not a constant&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 2T\left (\frac{n}{2}\right )+\frac{n}{\log n}&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;non-polynomial difference between f(n) and &amp;lt;math&amp;gt;n^{\log_b a}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 0.5T\left (\frac{n}{2}\right )+n&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&#039;&#039;a&#039;&#039;&amp;lt;1 cannot have less than one sub problem&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 64T\left (\frac{n}{8}\right )-n^2\log n&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;f(n) is not positive&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = T\left (\frac{n}{2}\right )+n(2-\cos n)&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;case 3 but regularity violation.&lt;br /&gt;
&lt;br /&gt;
Also, Case 3 always hold when f = n^k and If &amp;lt;math&amp;gt;f(n) \in \Omega(n^{log_b {a+\mathcal{E}}})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Log Laws ===&lt;br /&gt;
For all real a &amp;gt; 0, b &amp;gt; 0, c &amp;gt; 0, and n, &lt;br /&gt;
*&amp;lt;math&amp;gt;a = b^{\log_b a}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_c ab = \log_c a + \log_c b&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b a^n = n \log_b a&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b a = \frac{\log_c a}{\log_c b}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b \frac{1}{a} = -\log_b a&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b a = \frac{1}{\log_a b}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;a^{\log_b c} = c^{\log_b a}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Summation ===&lt;br /&gt;
*Arithmetic Series:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=1}^n(k) = 1 + 2 + \dots + n} = \frac{1}{2}n(n + 1)&amp;lt;/math&amp;gt;&lt;br /&gt;
*Sum of Squares:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^n(k^2)} = \frac{n(n+1)(2n+1)}{6}&amp;lt;/math&amp;gt;&lt;br /&gt;
*Sum of Cubes:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^n(k^3)} = \frac{n^2(n+1)^2}{4}&amp;lt;/math&amp;gt;&lt;br /&gt;
*Geometric Series:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^n(x^k) = 1 + x + x^2 + \dots + x^k} = \frac{x^{n + 1} - 1}{x -1 }, &amp;lt;/math&amp;gt; for real &amp;lt;math&amp;gt; x \ne 1&amp;lt;/math&amp;gt;&lt;br /&gt;
*Infinite decreasing: &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^{\infty}(x^k) = \frac{1}{ 1 - x }, for  |x| &amp;lt; 1 } &amp;lt;/math&amp;gt;&lt;br /&gt;
*Telescoping: &amp;lt;math&amp;gt; \displaystyle{\sum_{k=1}^{n-1}(a_{k} - a_{k +1}) = a_0 - a_n } &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Exponents===&lt;br /&gt;
* &amp;lt;math&amp;gt;a^0 = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a^1 = a&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a^{-1} = \frac{1}{a}&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;(a^m)^n = a^{mn}&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a^m \times a^n = a^{m+n}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Decision Tree-Related Notes ===&lt;br /&gt;
&lt;br /&gt;
* for a list of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; elements, there&#039;s &amp;lt;math&amp;gt;n!&amp;lt;/math&amp;gt; permutations&lt;br /&gt;
* a binary tree of height &amp;lt;math&amp;gt;d&amp;lt;/math&amp;gt; has at most &amp;lt;math&amp;gt;2^d&amp;lt;/math&amp;gt; leaves&lt;br /&gt;
* therefore, a binary tree with at least &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; leaves must have height at least &amp;lt;math&amp;gt;\lceil \lg n\rceil&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;\lg(n!) \in \Theta(n \lg n)&amp;lt;/math&amp;gt;, which we can establish by proving big-O and big-&amp;amp;Omega; bounds separately (pumping &amp;quot;up&amp;quot; or &amp;quot;down&amp;quot; the values of the terms in the factorial and the overall number of terms as needed)&lt;br /&gt;
&lt;br /&gt;
=== Stirling&#039;s Approximation ===&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;\ln n! \sim n\ln n - n\ .&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Derivatives ===&lt;br /&gt;
d/dx a^f(x) = a^f(x) * d(f(x))/dx * ln(a)&lt;br /&gt;
&lt;br /&gt;
=== The Silicon Downs : Furlongs of Asymptotic Complexity ===&lt;br /&gt;
&lt;br /&gt;
&amp;quot;NEWS FLASH: Mounties Find Silicon Downs Fixed!&amp;quot;&lt;br /&gt;
* Constant &amp;lt;math&amp;gt; \in O(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Logarithmic &amp;lt;math&amp;gt; \in O(log n)&amp;lt;/math&amp;gt;   ie. &amp;lt;math&amp;gt;log_k n , log n^2 \in O(log n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Poly-Log &amp;lt;math&amp;gt; \in O(log^k n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Linear &amp;lt;math&amp;gt; \in O(n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Log-Linear &amp;lt;math&amp;gt; \in O(n log n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Superlinear &amp;lt;math&amp;gt; \in O(n^1+c)&amp;lt;/math&amp;gt; where: c is a constant &amp;gt; 0&lt;br /&gt;
* Quadratic &amp;lt;math&amp;gt; \in O(n^2)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Cubic &amp;lt;math&amp;gt; \in O(n^3)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Polynomial &amp;lt;math&amp;gt; \in O(n^k)&amp;lt;/math&amp;gt; where: k is a constant, &amp;quot;tractable&amp;quot;&lt;br /&gt;
* Exponential &amp;lt;math&amp;gt; \in O(c^n)&amp;lt;/math&amp;gt; where: c is a constant &amp;gt; 1, &amp;quot;intractable&amp;quot;&lt;/div&gt;</summary>
		<author><name>Niels</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC_320/Midterm_1_Reference_Sheet&amp;diff=19051</id>
		<title>Course:CPSC 320/Midterm 1 Reference Sheet</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC_320/Midterm_1_Reference_Sheet&amp;diff=19051"/>
		<updated>2010-02-02T01:03:06Z</updated>

		<summary type="html">&lt;p&gt;Niels: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== CPSC 320 2009W2 Exam Reference Sheet ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Do not remove:&#039;&#039;&#039; This reference sheet is the appendix for Midterm #1.  Only the first 4 printed pages will be used; so be compact!&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in O(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;\exist c \in \mathbf{R^+}, \exist n_0 \in \mathbf{Z^+}, \forall n \in \mathbf{Z^+}, n \geq n_0 \rightarrow f(n) \leq c g(n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in \Omega(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;g(n) \in O(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in \Theta(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;f(n) \in O(g(n))&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;g(n) \in O(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in o(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;\forall c \in \mathbf{R^+}, \exist n_0 \in \mathbf{Z^+}, \forall n \in \mathbf{Z^+}, n \geq n_0 \rightarrow f(n) &amp;lt; c g(n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;f(n) \in \omega(g(n))&amp;lt;/math&amp;gt; iff &amp;lt;math&amp;gt;g(n) \in o(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also, if &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} =&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;f(n) \in \omega(g(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* a non-zero constant, then &amp;lt;math&amp;gt;f(n) \in \Theta(g(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;f(n) \in o(g(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(Plus bear in mind that (1) L&#039;Hopital&#039;s rule may be handy, and (2) the limit is not always well-defined!)&lt;br /&gt;
&lt;br /&gt;
L&#039;Hopital&#039;s Rule:&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} = \frac{0}{0}&amp;lt;/math&amp;gt;  or &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} = \frac{\infty}{\infty}&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;\displaystyle \lim_{n\to\infty} \frac{f(n)}{g(n)} = \frac{f(n)&#039;}{g(n)&#039;}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Master Theorem ===&lt;br /&gt;
If &amp;lt;math&amp;gt;\displaystyle T(n) = aT(&#039;&#039;n/b&#039;&#039;) + f(n)&amp;lt;/math&amp;gt; and a constant in the base case, where &amp;lt;math&amp;gt;&#039;&#039;n/b&#039;&#039;&amp;lt;/math&amp;gt; can be either &amp;lt;math&amp;gt;\lfloor n/b \rfloor&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;\lceil n/b \rceil&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt; a &amp;gt;= 1 &amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; b &amp;gt; 1 &amp;lt;/math&amp;gt; then:&lt;br /&gt;
* If &amp;lt;math&amp;gt;f(n) \in O(n^{log_b {a-\mathcal{E}}})&amp;lt;/math&amp;gt; for some &amp;lt;math&amp;gt;\mathcal{E} &amp;gt;0&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;T(n) \in \Theta(n^{log_b a})&amp;lt;/math&amp;gt;&lt;br /&gt;
** Dominated by leaf cost&lt;br /&gt;
* If &amp;lt;math&amp;gt;f(n) \in \Theta (n^{log_b a})&amp;lt;/math&amp;gt; then, &amp;lt;math&amp;gt;T(n) \in \Theta (n^{log_b a} lg n) &amp;lt;/math&amp;gt;&lt;br /&gt;
** Balanced cost&lt;br /&gt;
* If &amp;lt;math&amp;gt;f(n) \in \Omega(n^{log_b {a+\mathcal{E}}})&amp;lt;/math&amp;gt; for some &amp;lt;math&amp;gt;\mathcal{E} &amp;gt; 0&amp;lt;/math&amp;gt; and if &amp;lt;math&amp;gt;\displaystyle af(&#039;&#039;n/b&#039;&#039;) \leq cf(n)&amp;lt;/math&amp;gt; for some constant &amp;lt;math&amp;gt;\displaystyle c &amp;lt; 1&amp;lt;/math&amp;gt; and sufficiently large &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;, then &amp;lt;math&amp;gt;T(n) \in \Theta(f(n))&amp;lt;/math&amp;gt;&lt;br /&gt;
** Dominated by root cost&lt;br /&gt;
&lt;br /&gt;
The following equations cannot be solved using the master theorem:&amp;lt;ref&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 2^nT\left (\frac{n}{2}\right )+n^n&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&#039;&#039;a&#039;&#039; is not a constant&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 2T\left (\frac{n}{2}\right )+\frac{n}{\log n}&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;non-polynomial difference between f(n) and &amp;lt;math&amp;gt;n^{\log_b a}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 0.5T\left (\frac{n}{2}\right )+n&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&#039;&#039;a&#039;&#039;&amp;lt;1 cannot have less than one sub problem&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = 64T\left (\frac{n}{8}\right )-n^2\log n&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;f(n) is not positive&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;T(n) = T\left (\frac{n}{2}\right )+n(2-\cos n)&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;case 3 but regularity violation.&lt;br /&gt;
&lt;br /&gt;
Also, Case 3 always hold when f = n^k and If &amp;lt;math&amp;gt;f(n) \in \Omega(n^{log_b {a+\mathcal{E}}})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Log Laws ===&lt;br /&gt;
For all real a &amp;gt; 0, b &amp;gt; 0, c &amp;gt; 0, and n, &lt;br /&gt;
*&amp;lt;math&amp;gt;a = b^{\log_b a}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_c ab = \log_c a + \log_c b&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b a^n = n \log_b a&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b a = \frac{\log_c a}{\log_c b}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b \frac{1}{a} = -\log_b a&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;\log_b a = \frac{1}{\log_a b}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt;a^{\log_b c} = c^{\log_b a}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Summation ===&lt;br /&gt;
*Arithmetic Series:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=1}^n(k) = 1 + 2 + \dots + n} = \frac{1}{2}n(n + 1)&amp;lt;/math&amp;gt;&lt;br /&gt;
*Sum of Squares:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^n(k^2)} = \frac{n(n+1)(2n+1)}{6}&amp;lt;/math&amp;gt;&lt;br /&gt;
*Sum of Cubes:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^n(k^3)} = \frac{n^2(n+1)^2}{4}&amp;lt;/math&amp;gt;&lt;br /&gt;
*Geometric Series:  &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^n(x^k) = 1 + x + x^2 + \dots + x^k} = \frac{x^{n + 1} - 1}{x -1 }, &amp;lt;/math&amp;gt; for real &amp;lt;math&amp;gt; x \ne 1&amp;lt;/math&amp;gt;&lt;br /&gt;
*Infinite decreasing: &amp;lt;math&amp;gt;\displaystyle{\sum_{k=0}^{\infty}(x^k) = \frac{1}{ 1 - x }, for  |x| &amp;lt; 1 } &amp;lt;/math&amp;gt;&lt;br /&gt;
*Telescoping: &amp;lt;math&amp;gt; \displaystyle{\sum_{k=1}^{n-1}(a_{k} - a_{k +1}) = a_0 - a_n } &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Exponents===&lt;br /&gt;
* &amp;lt;math&amp;gt;a^0 = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a^1 = a&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a^{-1} = \frac{1}{a}&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;(a^m)^n = a^{mn}&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a^m \times a^n = a^{m+n}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Decision Tree-Related Notes ===&lt;br /&gt;
&lt;br /&gt;
* for a list of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; elements, there&#039;s &amp;lt;math&amp;gt;n!&amp;lt;/math&amp;gt; permutations&lt;br /&gt;
* a binary tree of height &amp;lt;math&amp;gt;d&amp;lt;/math&amp;gt; has at most &amp;lt;math&amp;gt;2^d&amp;lt;/math&amp;gt; leaves&lt;br /&gt;
* therefore, a binary tree with at least &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; leaves must have height at least &amp;lt;math&amp;gt;\lceil \lg n\rceil&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;\lg(n!) \in \Theta(n \lg n)&amp;lt;/math&amp;gt;, which we can establish by proving big-O and big-&amp;amp;Omega; bounds separately (pumping &amp;quot;up&amp;quot; or &amp;quot;down&amp;quot; the values of the terms in the factorial and the overall number of terms as needed)&lt;br /&gt;
&lt;br /&gt;
=== Stirling&#039;s Approximation ===&lt;br /&gt;
&lt;br /&gt;
*:&amp;lt;math&amp;gt;\ln n! \sim n\ln n - n\ .&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Derivatives ===&lt;br /&gt;
d/dx a^f(x) = a^f(x) * d(f(x))/dx * ln(a)&lt;br /&gt;
&lt;br /&gt;
=== The Silicon Downs : Furlongs of Asymptotic Complexity ===&lt;br /&gt;
&lt;br /&gt;
=&amp;quot;NEWS FLASH: Mounties Find Silicon Downs Fixed!&amp;quot;=&lt;br /&gt;
* Constant &amp;lt;math&amp;gt; \in O(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Logarithmic &amp;lt;math&amp;gt; \in O(log n)&amp;lt;/math&amp;gt;   ie. &amp;lt;math&amp;gt;log_k n , log n^2 \in O(log n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Poly-Log &amp;lt;math&amp;gt; \in O(log^k n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Linear &amp;lt;math&amp;gt; \in O(n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Log-Linear &amp;lt;math&amp;gt; \in O(n log n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Superlinear &amp;lt;math&amp;gt; \in O(n^1+c)&amp;lt;/math&amp;gt; where: c is a constant &amp;gt; 0&lt;br /&gt;
* Quadratic &amp;lt;math&amp;gt; \in O(n^2)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Cubic &amp;lt;math&amp;gt; \in O(n^3)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Polynomial &amp;lt;math&amp;gt; \in O(n^k)&amp;lt;/math&amp;gt; where: k is a constant, &amp;quot;tractable&amp;quot;&lt;br /&gt;
* Exponential &amp;lt;math&amp;gt; \in O(c^n)&amp;lt;/math&amp;gt; where: c is a constant &amp;gt; 1, &amp;quot;intractable&amp;quot;&lt;/div&gt;</summary>
		<author><name>Niels</name></author>
	</entry>
</feed>