<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.brandon-rodriguez.com/index.php?action=history&amp;feed=atom&amp;title=Algorithms_-_Runtime_Analysis</id>
	<title>Algorithms - Runtime Analysis - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.brandon-rodriguez.com/index.php?action=history&amp;feed=atom&amp;title=Algorithms_-_Runtime_Analysis"/>
	<link rel="alternate" type="text/html" href="https://wiki.brandon-rodriguez.com/index.php?title=Algorithms_-_Runtime_Analysis&amp;action=history"/>
	<updated>2026-05-07T13:41:28Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.brandon-rodriguez.com/index.php?title=Algorithms_-_Runtime_Analysis&amp;diff=28&amp;oldid=prev</id>
		<title>Brodriguez: Formatting</title>
		<link rel="alternate" type="text/html" href="https://wiki.brandon-rodriguez.com/index.php?title=Algorithms_-_Runtime_Analysis&amp;diff=28&amp;oldid=prev"/>
		<updated>2019-09-09T00:19:03Z</updated>

		<summary type="html">&lt;p&gt;Formatting&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 00:19, 9 September 2019&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l17&quot;&gt;Line 17:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 17:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Specific Asymptotic Bound Terms:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Specific Asymptotic Bound Terms:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* &amp;#039;&amp;#039;&amp;#039;Big O&amp;#039;&amp;#039;&amp;#039; (&amp;#039;&amp;#039;&amp;#039;O(f(n))&amp;#039;&amp;#039;&amp;#039;) - Pronounced &amp;quot;Big Oh&amp;quot;, it&amp;#039;s the &amp;#039;&amp;#039;&amp;#039;Worst Case&amp;#039;&amp;#039;&amp;#039;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* &amp;#039;&amp;#039;&amp;#039;Big O&amp;#039;&amp;#039;&amp;#039; ( &amp;#039;&amp;#039;&amp;#039;O(f(n))&amp;#039;&amp;#039;&amp;#039; ) - Pronounced &amp;quot;Big Oh&amp;quot;, it&amp;#039;s the &amp;#039;&amp;#039;&amp;#039;Worst Case&amp;#039;&amp;#039;&amp;#039;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;** This is the Asymptotic Upper Bound of runtime. Aka, the maximum possible time to run a given algorithm.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;** This is the Asymptotic Upper Bound of runtime. Aka, the maximum possible time to run a given algorithm.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* &amp;#039;&amp;#039;&amp;#039;Big Ω&amp;#039;&amp;#039;&amp;#039; (&amp;#039;&amp;#039;&amp;#039;Ω(f(n))&amp;#039;&amp;#039;&amp;#039;) - Pronounced &amp;quot;Big Omega&amp;quot;, it&amp;#039;s the &amp;#039;&amp;#039;&amp;#039;Best Case&amp;#039;&amp;#039;&amp;#039;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* &amp;#039;&amp;#039;&amp;#039;Big Ω&amp;#039;&amp;#039;&amp;#039; ( &amp;#039;&amp;#039;&amp;#039;Ω(f(n))&amp;#039;&amp;#039;&amp;#039; ) - Pronounced &amp;quot;Big Omega&amp;quot;, it&amp;#039;s the &amp;#039;&amp;#039;&amp;#039;Best Case&amp;#039;&amp;#039;&amp;#039;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;** This is the Asymptotic Lower Bound of runtime. Aka, the minimum possible time to run a given algorithm.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;** This is the Asymptotic Lower Bound of runtime. Aka, the minimum possible time to run a given algorithm.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* &amp;#039;&amp;#039;&amp;#039;Big θ&amp;#039;&amp;#039;&amp;#039; (&amp;#039;&amp;#039;&amp;#039;θ(f(n))&amp;#039;&amp;#039;&amp;#039;) - Pronounced &amp;quot;Big Theta&amp;quot;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* &amp;#039;&amp;#039;&amp;#039;Big θ&amp;#039;&amp;#039;&amp;#039; ( &amp;#039;&amp;#039;&amp;#039;θ(f(n))&amp;#039;&amp;#039;&amp;#039; ) - Pronounced &amp;quot;Big Theta&amp;quot;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;** This is when we find an expression that simultaneously fits an algorithm for both Upper and Lower bound.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;** This is when we find an expression that simultaneously fits an algorithm for both Upper and Lower bound.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* &amp;#039;&amp;#039;&amp;#039;Little O&amp;#039;&amp;#039;&amp;#039; - A Upper Bound of runtime that technically describes the equation, but isn&amp;#039;t the closest possible fit.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* &amp;#039;&amp;#039;&amp;#039;Little O&amp;#039;&amp;#039;&amp;#039; - A Upper Bound of runtime that technically describes the equation, but isn&amp;#039;t the closest possible fit.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key dev_wiki:diff::1.12:old-27:rev-28 --&gt;
&lt;/table&gt;</summary>
		<author><name>Brodriguez</name></author>
	</entry>
	<entry>
		<id>https://wiki.brandon-rodriguez.com/index.php?title=Algorithms_-_Runtime_Analysis&amp;diff=27&amp;oldid=prev</id>
		<title>Brodriguez: Formatting</title>
		<link rel="alternate" type="text/html" href="https://wiki.brandon-rodriguez.com/index.php?title=Algorithms_-_Runtime_Analysis&amp;diff=27&amp;oldid=prev"/>
		<updated>2019-09-08T23:28:15Z</updated>

		<summary type="html">&lt;p&gt;Formatting&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 23:28, 8 September 2019&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l58&quot;&gt;Line 58:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 58:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;5/n ≥ c - 5&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;5/n ≥ c - 5&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Now we can give n any arbitrary value, so long as it lets us solve for a valid c.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Now we can give n any arbitrary value, so long as it lets us solve for a valid c.&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;br&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;If n = 5, then:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;If n = 5, then:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l78&quot;&gt;Line 78:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 78:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;A quicker, less formal way to calculate the Big O, Big Ω and Big θ is to simply take the leading term of the equation, drop all other terms, and drop any constants.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;A quicker, less formal way to calculate the Big O, Big Ω and Big θ is to simply take the leading term of the equation, drop all other terms, and drop any constants.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;For example, &amp;lt;code&amp;gt;O(f(n))=7n + 5&amp;lt;/code&amp;gt; simplifies to &amp;lt;code&amp;gt;O(f(n))=7n&amp;lt;/code&amp;gt; which simplifies to &amp;lt;code&amp;gt;O(f(n))=n&amp;lt;/code&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;For example, &amp;lt;code&amp;gt;O(f(n))=7n + 5&amp;lt;/code&amp;gt; simplifies to &amp;lt;code&amp;gt;O(f(n))=7n&amp;lt;/code&amp;gt; which simplifies to &amp;lt;code&amp;gt;O(f(n))=n&amp;lt;/code&amp;gt;.&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;br&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Similarly, &amp;lt;code&amp;gt;Ω(f(n))=5n + 5&amp;lt;/code&amp;gt; simplifies to &amp;lt;code&amp;gt;Ω(f(n))=5n&amp;lt;/code&amp;gt; which simplifies to &amp;lt;code&amp;gt;Ω(f(n))=n&amp;lt;/code&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Similarly, &amp;lt;code&amp;gt;Ω(f(n))=5n + 5&amp;lt;/code&amp;gt; simplifies to &amp;lt;code&amp;gt;Ω(f(n))=5n&amp;lt;/code&amp;gt; which simplifies to &amp;lt;code&amp;gt;Ω(f(n))=n&amp;lt;/code&amp;gt;.&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;br&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Thus, both Big O and Big Ω equal n, giving us Big θ of n as well.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Thus, both Big O and Big Ω equal n, giving us Big θ of n as well.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l85&quot;&gt;Line 85:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 85:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Let&amp;#039;s pretend we have an algorithm with a Best Case cost of &amp;lt;code&amp;gt;3n + 7&amp;lt;/code&amp;gt; and a Worst Case cost of &amp;lt;code&amp;gt;5n^2 + 2n - 12&amp;lt;/code&amp;gt;. We can quickly calculate:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Let&amp;#039;s pretend we have an algorithm with a Best Case cost of &amp;lt;code&amp;gt;3n + 7&amp;lt;/code&amp;gt; and a Worst Case cost of &amp;lt;code&amp;gt;5n^2 + 2n - 12&amp;lt;/code&amp;gt;. We can quickly calculate:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;code&amp;gt;Ω(f(n))=3n + 7&amp;lt;/code&amp;gt; -&amp;gt; &amp;lt;code&amp;gt;Ω(f(n))=3n&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;Ω(f(n))=n&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;code&amp;gt;Ω(f(n))=3n + 7&amp;lt;/code&amp;gt; -&amp;gt; &amp;lt;code&amp;gt;Ω(f(n))=3n&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;Ω(f(n))=n&amp;lt;/code&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;gt;&amp;lt;br&lt;/ins&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;code&amp;gt;O(f(n))=5n^2 + 2n - 12&amp;lt;/code&amp;gt; -&amp;gt; &amp;lt;code&amp;gt;O(f(n))=5n^2&amp;lt;/code&amp;gt; -&amp;gt; &amp;lt;code&amp;gt;O(f(n))=n^2&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;code&amp;gt;O(f(n))=5n^2 + 2n - 12&amp;lt;/code&amp;gt; -&amp;gt; &amp;lt;code&amp;gt;O(f(n))=5n^2&amp;lt;/code&amp;gt; -&amp;gt; &amp;lt;code&amp;gt;O(f(n))=n^2&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Note that in this example, &amp;lt;code&amp;gt;Ω(n)≠O(n^2)&amp;lt;/code&amp;gt;, so θ(f(n)) does not exist.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Note that in this example, &amp;lt;code&amp;gt;Ω(n)≠O(n^2)&amp;lt;/code&amp;gt;, so θ(f(n)) does not exist.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key dev_wiki:diff::1.12:old-26:rev-27 --&gt;
&lt;/table&gt;</summary>
		<author><name>Brodriguez</name></author>
	</entry>
	<entry>
		<id>https://wiki.brandon-rodriguez.com/index.php?title=Algorithms_-_Runtime_Analysis&amp;diff=26&amp;oldid=prev</id>
		<title>Brodriguez: Create page</title>
		<link rel="alternate" type="text/html" href="https://wiki.brandon-rodriguez.com/index.php?title=Algorithms_-_Runtime_Analysis&amp;diff=26&amp;oldid=prev"/>
		<updated>2019-09-08T23:26:52Z</updated>

		<summary type="html">&lt;p&gt;Create page&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Code running time is essentially the amount of time a piece of code will take to complete. We can use [[Algorithms - Primitive Operations|Primitive Operations]] to calculate this amount of time, which can be simplified down to a set of equations.&lt;br /&gt;
&lt;br /&gt;
We simplify down to equations because the actual runtime will vary based on things like hardware, and size of input data.&lt;br /&gt;
&lt;br /&gt;
Generally speaking, the hardware/software environment will only improve running time by a constant factor. However, size of input data can make runtime grow much larger, depending on the design and implementation of algorithm. It turns out that implementation of code can have more impact on speed than simply upgrading to new hardware, which is why the study of Algorithms exists.&lt;br /&gt;
&lt;br /&gt;
=== Algorithm Complexity ===&lt;br /&gt;
When analyzing complexity, we generally refer to the &amp;#039;&amp;#039;&amp;#039;Order of Growth&amp;#039;&amp;#039;&amp;#039;, aka, examining how an algorithm behaves with unbounded or absurdly large data sets. When dealing with Order of Growth, runtime equations generally simplify to whatever the leading term is, as all other terms become insignificant in comparison.&lt;br /&gt;
&lt;br /&gt;
As result, equations can generally be categorized onto the following graph:&lt;br /&gt;
&amp;lt;TODO: graph here&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By using this, we can find an &amp;#039;&amp;#039;&amp;#039;Asymptotic Bound&amp;#039;&amp;#039;&amp;#039; g(n), which mostly closely describes Orders of Growth for the given equation f(n).&lt;br /&gt;
&lt;br /&gt;
== Fitting to Asymptotic Bounds ==&lt;br /&gt;
Generally speaking, we look minimum runtime (known as &amp;quot;Best Case&amp;quot;), maximum runtime (known as &amp;quot;Worst Case&amp;quot;), and sometimes average case runtime.&lt;br /&gt;
&lt;br /&gt;
Specific Asymptotic Bound Terms:&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Big O&amp;#039;&amp;#039;&amp;#039; (&amp;#039;&amp;#039;&amp;#039;O(f(n))&amp;#039;&amp;#039;&amp;#039;) - Pronounced &amp;quot;Big Oh&amp;quot;, it&amp;#039;s the &amp;#039;&amp;#039;&amp;#039;Worst Case&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
** This is the Asymptotic Upper Bound of runtime. Aka, the maximum possible time to run a given algorithm.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Big Ω&amp;#039;&amp;#039;&amp;#039; (&amp;#039;&amp;#039;&amp;#039;Ω(f(n))&amp;#039;&amp;#039;&amp;#039;) - Pronounced &amp;quot;Big Omega&amp;quot;, it&amp;#039;s the &amp;#039;&amp;#039;&amp;#039;Best Case&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
** This is the Asymptotic Lower Bound of runtime. Aka, the minimum possible time to run a given algorithm.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Big θ&amp;#039;&amp;#039;&amp;#039; (&amp;#039;&amp;#039;&amp;#039;θ(f(n))&amp;#039;&amp;#039;&amp;#039;) - Pronounced &amp;quot;Big Theta&amp;quot;.&lt;br /&gt;
** This is when we find an expression that simultaneously fits an algorithm for both Upper and Lower bound.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Little O&amp;#039;&amp;#039;&amp;#039; - A Upper Bound of runtime that technically describes the equation, but isn&amp;#039;t the closest possible fit.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Little Ω&amp;#039;&amp;#039;&amp;#039; - A Lower Bound of runtime that technically describes the equation, but isn&amp;#039;t the closest possible fit.&lt;br /&gt;
&lt;br /&gt;
More often than not, average runtime can be difficult to determine, and often may vary based on the input data itself. Best case runtime can be good to know, but the concern is usually to prevent an block of code from taking too long to run. Thus, Worst Case runtime is often the focus of analysis.&lt;br /&gt;
&lt;br /&gt;
=== Officially Calculating the Worst Case ===&lt;br /&gt;
Given any runtime equation f(n), we want to determine if the Asymptotic Bound g(n) is a valid Big O.&lt;br /&gt;
&lt;br /&gt;
To calculate this plug this into the equation &amp;lt;code&amp;gt;f(n) ≤ c * g(n)&amp;lt;/code&amp;gt; and simplify. If we can find any arbitrary set of values for &amp;#039;&amp;#039;&amp;#039;c&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;n&amp;#039;&amp;#039;&amp;#039; where the equation holds true, then this is a valid Big O for f(n), aka a valid O(f(n)).&lt;br /&gt;
&lt;br /&gt;
For example, let&amp;#039;s take the worst case values from [[Algorithms - Primitive Operations|Primitive Operations]] and prove that the Big O falls under &amp;#039;&amp;#039;&amp;#039;n&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
f(n) ≤ c * g(n) where [f(n)=7n + 5] and [g(n)=n]&lt;br /&gt;
7n + 5 ≤ c * n&lt;br /&gt;
5 ≤ cn - 7n&lt;br /&gt;
5/n ≤ c - 7&lt;br /&gt;
&lt;br /&gt;
Now we can give n any arbitrary value, so long as it lets us solve for a valid c.&lt;br /&gt;
If n = 5, then:&lt;br /&gt;
&lt;br /&gt;
5/5 ≤ c - 7&lt;br /&gt;
1 ≤ c - 7&lt;br /&gt;
8 ≤ c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus, with &amp;lt;code&amp;gt;n=5, c≥8&amp;lt;/code&amp;gt;we have found once instance of a valid &amp;#039;&amp;#039;&amp;#039;c&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;n&amp;#039;&amp;#039;&amp;#039; such that the inequality holds true. So O(7n + 5) = n.&lt;br /&gt;
&lt;br /&gt;
=== Officially Calculating the Best Case ===&lt;br /&gt;
Similar to above, but we instead use the equation [f(n) ≥ c * g(n)]. Using the best case values from [[Algorithms - Primitive Operations|Primitive Operations]], can can prove that Big Ω falls under &amp;#039;&amp;#039;&amp;#039;n&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
f(n) ≥ c * g(n) where [f(n)=5n + 5] and [g(n)=n]&lt;br /&gt;
5n + 5 ≥ c * n&lt;br /&gt;
5 ≥ cn - 5n&lt;br /&gt;
5/n ≥ c - 5&lt;br /&gt;
&lt;br /&gt;
Now we can give n any arbitrary value, so long as it lets us solve for a valid c.&lt;br /&gt;
If n = 5, then:&lt;br /&gt;
&lt;br /&gt;
5/5 ≥ c - 5&lt;br /&gt;
1 ≥ c - 5&lt;br /&gt;
6 ≥ c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus, with &amp;lt;code&amp;gt;n=5, c≤6&amp;lt;/code&amp;gt;we have found once instance of a valid &amp;#039;&amp;#039;&amp;#039;c&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;n&amp;#039;&amp;#039;&amp;#039; such that the inequality holds true. So Ω(5n + 5) = n.&lt;br /&gt;
&lt;br /&gt;
=== Officially Calculating the Big Theta ===&lt;br /&gt;
Through the two above examples, we have calculated the O(f(n)) and Ω(f(n)) for a given piece of code. Coincidentally, they both turned out to equal &amp;#039;&amp;#039;&amp;#039;n&amp;#039;&amp;#039;&amp;#039;. Thus Big θ can also be determined to be n.&lt;br /&gt;
&lt;br /&gt;
The only way to calculate this is through calculating both Big O and Big Ω. If the two values are not identical, then the algorithm does not have a Big θ.&lt;br /&gt;
&lt;br /&gt;
=== Quickly Calculating the Asymptotic Bounds ===&lt;br /&gt;
The above examples were quick enough for a relatively simple problem. But for more larger algorithms, things can get complicated fast.&lt;br /&gt;
&lt;br /&gt;
A quicker, less formal way to calculate the Big O, Big Ω and Big θ is to simply take the leading term of the equation, drop all other terms, and drop any constants.&lt;br /&gt;
&lt;br /&gt;
For example, &amp;lt;code&amp;gt;O(f(n))=7n + 5&amp;lt;/code&amp;gt; simplifies to &amp;lt;code&amp;gt;O(f(n))=7n&amp;lt;/code&amp;gt; which simplifies to &amp;lt;code&amp;gt;O(f(n))=n&amp;lt;/code&amp;gt;.&lt;br /&gt;
Similarly, &amp;lt;code&amp;gt;Ω(f(n))=5n + 5&amp;lt;/code&amp;gt; simplifies to &amp;lt;code&amp;gt;Ω(f(n))=5n&amp;lt;/code&amp;gt; which simplifies to &amp;lt;code&amp;gt;Ω(f(n))=n&amp;lt;/code&amp;gt;.&lt;br /&gt;
Thus, both Big O and Big Ω equal n, giving us Big θ of n as well.&lt;br /&gt;
&lt;br /&gt;
==== Further Examples ====&lt;br /&gt;
Let&amp;#039;s pretend we have an algorithm with a Best Case cost of &amp;lt;code&amp;gt;3n + 7&amp;lt;/code&amp;gt; and a Worst Case cost of &amp;lt;code&amp;gt;5n^2 + 2n - 12&amp;lt;/code&amp;gt;. We can quickly calculate:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Ω(f(n))=3n + 7&amp;lt;/code&amp;gt; -&amp;gt; &amp;lt;code&amp;gt;Ω(f(n))=3n&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;Ω(f(n))=n&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;O(f(n))=5n^2 + 2n - 12&amp;lt;/code&amp;gt; -&amp;gt; &amp;lt;code&amp;gt;O(f(n))=5n^2&amp;lt;/code&amp;gt; -&amp;gt; &amp;lt;code&amp;gt;O(f(n))=n^2&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in this example, &amp;lt;code&amp;gt;Ω(n)≠O(n^2)&amp;lt;/code&amp;gt;, so θ(f(n)) does not exist.&lt;/div&gt;</summary>
		<author><name>Brodriguez</name></author>
	</entry>
</feed>