<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://algorist.com/algowiki_v2/index.php?action=history&amp;feed=atom&amp;title=TADM2E_4.17</id>
		<title>TADM2E 4.17 - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://algorist.com/algowiki_v2/index.php?action=history&amp;feed=atom&amp;title=TADM2E_4.17"/>
		<link rel="alternate" type="text/html" href="https://algorist.com/algowiki_v2/index.php?title=TADM2E_4.17&amp;action=history"/>
		<updated>2026-05-01T05:24:23Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.28.0</generator>

	<entry>
		<id>https://algorist.com/algowiki_v2/index.php?title=TADM2E_4.17&amp;diff=313&amp;oldid=prev</id>
		<title>Dentin: Create page.  Only managed an upper bound estimate for part b.</title>
		<link rel="alternate" type="text/html" href="https://algorist.com/algowiki_v2/index.php?title=TADM2E_4.17&amp;diff=313&amp;oldid=prev"/>
				<updated>2015-04-16T22:37:03Z</updated>
		
		<summary type="html">&lt;p&gt;Create page.  Only managed an upper bound estimate for part b.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
== Part A ==&lt;br /&gt;
&lt;br /&gt;
Always choosing the median splits the halves evenly, resulting in log(n) passes, with each pass having n compares.  The total would be n log(n).&lt;br /&gt;
&lt;br /&gt;
== Part B ==&lt;br /&gt;
&lt;br /&gt;
Let F(n) be the number of compares for a quicksort of size n, split into a section of size 1/3 and a section of size 2/3.  The recurrence relation would be:&lt;br /&gt;
&lt;br /&gt;
F(n) = n/3 + 2n/3 + F(n/3) + F(2n/3) = n + F(n/3) + F(2n/3)&lt;br /&gt;
&lt;br /&gt;
In other words, the number of compares at size n is equal to the number of compares to do a top level partition (1/3 for one side, 2/3 for the other side), plus the number of compares to quicksort the 1/3 partition and the 2/3 partition.&lt;br /&gt;
&lt;br /&gt;
=== Upper bound appoximation ===&lt;br /&gt;
&lt;br /&gt;
One way to get an upper bound for the number of compares is to assume that there are N compares at all levels, and use the maximum partition depth.  The maximum partition depth is the depth of the worst case 2/3 partition.&lt;br /&gt;
&lt;br /&gt;
For a 1/2 partition, you would expect a depth of log[base2](n), but for a 2/3 partition, you would expect a depth of log[base3/2](n).  Switching from log of base 3/2 to log of base 2 yields:&lt;br /&gt;
&lt;br /&gt;
log[base3/2](n) = log[base2](n) / log[base2](3/2) ~= log[base2](n) / 0.585 = 1.71 log(n)&lt;br /&gt;
&lt;br /&gt;
So one upper bound would be 1.71 n log(n).&lt;/div&gt;</summary>
		<author><name>Dentin</name></author>	</entry>

	</feed>