<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Codebreaker &#187; cs445</title>
	<atom:link href="http://blog.sumin.us/archives/tag/cs445/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.sumin.us</link>
	<description>2bc08752a0894eb2c7afb345286e391d</description>
	<lastBuildDate>Wed, 08 Sep 2010 02:15:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Class Note for CS445 on Jan 27, 2009</title>
		<link>http://blog.sumin.us/archives/925</link>
		<comments>http://blog.sumin.us/archives/925#comments</comments>
		<pubDate>Tue, 27 Jan 2009 23:44:26 +0000</pubDate>
		<dc:creator>Sumin</dc:creator>
				<category><![CDATA[computer science]]></category>
		<category><![CDATA[classnote]]></category>
		<category><![CDATA[cs445]]></category>

		<guid isPermaLink="false">http://blog.sumin.us/?p=925</guid>
		<description><![CDATA[Announcements Optional discussion section meets on Wednesday, 7-8pm at FCS 101 Largest Empty Rectangle Problem Divide and conquer function DivideAndConquer(A, m, n) begin PrecomputeLeftRuns(...) PrecomputeRightRuns(...) return DivAndConq(A, m, 1, n, L, R) end DevAndConq() PrecomputeLeftRuns() + PrecomputeRightRus() Total number of rectangles [m 2] * [n 2] = m*(m-1)/2 * n*(n-1)/2 (pair of rows) (pair of [...]]]></description>
			<content:encoded><![CDATA[<h3>Announcements</h3>

<p>Optional discussion section meets on Wednesday, 7-8pm at FCS 101</p>

<h3>Largest Empty Rectangle Problem</h3>

<h4>Divide and conquer</h4>

<pre><code>function DivideAndConquer(A, m, n) begin
    PrecomputeLeftRuns(...)
    PrecomputeRightRuns(...)
    return DivAndConq(A, m, 1, n, L, R)
end
</code></pre>

<h5>DevAndConq()</h5>

<p><img src="http://blog.sumin.us/wp-content/cache/tex_165ad1a0998553d376bec223c7fd7a78.png" align="absmiddle" class="tex" alt="T(m, n) = 2T(m, n/2) + \Theta(m^2) = \Theta(m^2n)" /></p>

<h5>PrecomputeLeftRuns() + PrecomputeRightRus()</h5>

<p><img src="http://blog.sumin.us/wp-content/cache/tex_d24bc92f3ade3cab939ab90e47d2a400.png" align="absmiddle" class="tex" alt="\Theta(mn) + \Theta(m^2n)" /></p>

<h5>Total number of rectangles</h5>

<pre><code>[m 2]          * [n 2]           = m*(m-1)/2 * n*(n-1)/2
(pair of rows)   (pair of cols)  theta(m^2)  theta(n^2)
</code></pre>

<p>To sum up, for Largest Empty Rectangle, we've seen following algorithms:</p>

<ul>
<li>Exhaustive search (<img src="http://blog.sumin.us/wp-content/cache/tex_964eae066ba974118fcbb85e0a77e842.png" align="absmiddle" class="tex" alt="\Theta(m^3n^3)" /> time)</li>
<li>[Optimized exhaustive search (<img src="http://blog.sumin.us/wp-content/cache/tex_61f471ff88971ccea8f15d716f194650.png" align="absmiddle" class="tex" alt="\Theta(m^2n^2)" /> time)]</li>
<li>Divide and conquer (<img src="http://blog.sumin.us/wp-content/cache/tex_ea1f2f3f0a626e55c015915fe4fa27f8.png" align="absmiddle" class="tex" alt="\Theta(m^2n)" /> time)</li>
<li>[Dynamic programming (<img src="http://blog.sumin.us/wp-content/cache/tex_ea1f2f3f0a626e55c015915fe4fa27f8.png" align="absmiddle" class="tex" alt="\Theta(m^2n)" /> time)]</li>
<li>[Amortization (<img src="http://blog.sumin.us/wp-content/cache/tex_cbbfa02ec80f805a0df6ef55bd135d2d.png" align="absmiddle" class="tex" alt="\Theta(mn)" /> time)] (optimal)</li>
</ul>
<!-- AdSense Now! V1.83 -->
<!-- Post[count: 2] -->
<div class="adsense adsense-leadout" style="text-align:center;margin: 12px;"><script type="text/javascript"><!--
google_ad_client = "pub-2353453386862167";
/* 468x60, created 10/26/09 */
google_ad_slot = "1252542387";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>]]></content:encoded>
			<wfw:commentRss>http://blog.sumin.us/archives/925/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Class Note for SC445 on Jan 20, 2009</title>
		<link>http://blog.sumin.us/archives/854</link>
		<comments>http://blog.sumin.us/archives/854#comments</comments>
		<pubDate>Wed, 21 Jan 2009 06:52:34 +0000</pubDate>
		<dc:creator>Sumin</dc:creator>
				<category><![CDATA[computer science]]></category>
		<category><![CDATA[classnote]]></category>
		<category><![CDATA[cs445]]></category>

		<guid isPermaLink="false">http://blog.sumin.us/?p=854</guid>
		<description><![CDATA[Announcements Office hours posted on the course webpage: M-F Optional discussion section will be on Wednesdays at 7-8pm Problem (Largest Monochromatic Rectangle) Given an m*n boolean array A[1:m, 1:n] of zeroes and ones, find a subarray A[i:k, j:l] that contains only zeros. Exhaustive Search (examine all possibilities; pick the best one) function exhaustive(A, m, n) [...]]]></description>
			<content:encoded><![CDATA[<h3>Announcements</h3>

<ul>
<li>Office hours posted on the course webpage: M-F</li>
<li>Optional discussion section will be on Wednesdays at 7-8pm</li>
</ul>

<h3>Problem (Largest Monochromatic Rectangle)</h3>

<p>Given an m*n boolean array A[1:m, 1:n] of zeroes and ones, find a subarray A[i:k, j:l] that contains only zeros.</p>

<h4>Exhaustive Search (examine all possibilities; pick the best one)</h4>

<pre><code>function exhaustive(A, m, n) begin * returns the area of the largest solution
a := 0
for i := 1 to m do
for j := 1 to n do
for k := i to m do
for l := j to n do begin
scan A[i:k, j:l]
if it contains only zeroes then
a := max{a, (k-i+1)*(l-j+1)}
end (for)

return a
end (function)
</code></pre>

<ul>
<li>(a) scan - a := max{}</li>
<li>(b) for l:= j to n</li>
<li>(c) for k := i to m</li>
<li>(d) for j := 1 to n</li>
<li>(e) for i := 1 to m</li>
</ul>

<h4>Analysis</h4>

<ul>
<li><p>(a) <img src="http://blog.sumin.us/wp-content/cache/tex_3861dfc520bd1d2069aa0df79a0ddf02.png" align="absmiddle" class="tex" alt="\Theta((k-i)(l-j))" /></p></li>
<li><p>(b) <img src="http://blog.sumin.us/wp-content/cache/tex_5e0bd736e43c72947a0033842a8c42db.png" align="absmiddle" class="tex" alt="\displaystyle
\sum_{j=l}^n\Theta((k-i)(l-j))\\
= \Theta(\sum_{j=l}^n (k-i)(l-j))\\
= \Theta((k-i)\sum_{j=l}^n(l-j))\\
= \Theta((k-i)\sum_{x=0}^{n-j}x)\\
= \Theta((k-i)\Theta(n-j)^2)\\
= \Theta((k-i)(n-j)^2)
" /></p></li>
<li><p>(c) <img src="http://blog.sumin.us/wp-content/cache/tex_a0ed8c92ff831ac52742daab6c9206be.png" align="absmiddle" class="tex" alt="\displaystyle
\sum_{i=k}^m\Theta((k-i)(n-j)^2)\\
= \Theta(\sum_{i=k}^m(k-i)(n-j)^2)\\
= \Theta((n-j)^2 \sum_{i=k}^m(k-i))\\
= \Theta((n-j)^2 \sum_{x=0}^{m-1}x)
" /></p></li>
<li><p>(d) <img src="http://blog.sumin.us/wp-content/cache/tex_a10f2f9db3298aef90733623dd871871.png" align="absmiddle" class="tex" alt="\Theta((m-i)^2 n^3)" /></p></li>
<li><p>(e) <img src="http://blog.sumin.us/wp-content/cache/tex_6645adaedaa4639e1218597515e6fa58.png" align="absmiddle" class="tex" alt="\Theta(m^3 n^3)" /> : time for exhaustive search without any optimization</p></li>
</ul>

<h4>Notations and Formulas</h4>

<ul>
<li><img src="http://blog.sumin.us/wp-content/cache/tex_c7a5ed132201a087eedd29f5bb794677.png" align="absmiddle" class="tex" alt="\Theta(f(n))" /> upper- and lower-bounded by constant times f(n)  </li>
<li><img src="http://blog.sumin.us/wp-content/cache/tex_a9a1e1bc4bf0237c1260d1e60d20fb28.png" align="absmiddle" class="tex" alt="O(f(n))" /> upper-bounded by constant times f(n)  </li>
<li><p><img src="http://blog.sumin.us/wp-content/cache/tex_1a6ca9b6f344cf77802afb21cd114fb2.png" align="absmiddle" class="tex" alt="\Omega(f(n))" /> lower-bounded by constant times f(n)</p></li>
<li><p><img src="http://blog.sumin.us/wp-content/cache/tex_872066d1b912d73910dd4b1b1c6e208a.png" align="absmiddle" class="tex" alt="\sum \Theta(f(i)) = \Theta(\sum f(i))" /> (almost always)</p></li>
<li><img src="http://blog.sumin.us/wp-content/cache/tex_3207d4ca2e69ea08e7fbc0ddc9894b73.png" align="absmiddle" class="tex" alt="\displaystyle \sum_{i=1}^n i^k = \Theta(n^{k+1})" /></li>
</ul>

<h4>Divide and Conquer</h4>

<p>Cut the input array vertically at the middle column. Then the optimal rectangle falls into three cases:</p>

<ol>
<li>It lies strictly in left half. (recurse)</li>
<li>It lies strictly in right half. (recurse)</li>
<li>It spans the middle. (some work to do)</li>
</ol>

<p>If we cut it at the middle column, it breaks into a left rectangle that ends at the middle column and is optimal, and a right rectangle that starts at the middle column and is optimal. (where the start and end rows i and k are fixed -&gt; new subproblem!)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sumin.us/archives/854/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
