<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://wiki.kram.nz/index.php?action=history&amp;feed=atom&amp;title=SE250%3Alab-6%3Amabd065</id>
	<title>SE250:lab-6:mabd065 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.kram.nz/index.php?action=history&amp;feed=atom&amp;title=SE250%3Alab-6%3Amabd065"/>
	<link rel="alternate" type="text/html" href="https://wiki.kram.nz/index.php?title=SE250:lab-6:mabd065&amp;action=history"/>
	<updated>2026-04-30T18:46:41Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://wiki.kram.nz/index.php?title=SE250:lab-6:mabd065&amp;diff=7197&amp;oldid=prev</id>
		<title>Mark: 2 revision(s)</title>
		<link rel="alternate" type="text/html" href="https://wiki.kram.nz/index.php?title=SE250:lab-6:mabd065&amp;diff=7197&amp;oldid=prev"/>
		<updated>2008-11-03T05:20:06Z</updated>

		<summary type="html">&lt;p&gt;2 revision(s)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;The first thing i did was looking at the code. &lt;br /&gt;
&lt;br /&gt;
=== Task1 ===&lt;br /&gt;
After i understod the makeRandomTree() and show_tree() i wrote the following code:&lt;br /&gt;
&lt;br /&gt;
 int main() {&lt;br /&gt;
     int i = 0;&lt;br /&gt;
     for ( ; i &amp;lt; 4; i++) { &lt;br /&gt;
 	show_tree(0, makeRandomTree(100));&lt;br /&gt;
 	printf(&amp;quot;------------\n\n&amp;quot;);&lt;br /&gt;
     }&lt;br /&gt;
     return 0; &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The code prints 4 random trees each time i change the number of nodes in a rendom tree. I varied the number of nodes &lt;br /&gt;
&lt;br /&gt;
 between 10 and a 100.&lt;br /&gt;
&lt;br /&gt;
 Size	Trial1	Trial2	Trial3	Trial4	Average Height&lt;br /&gt;
 10	5	5	3	4	4&lt;br /&gt;
 20	8	6	8	6	7&lt;br /&gt;
 30	9	9	8	7	8&lt;br /&gt;
 40	9	8	11	9	9&lt;br /&gt;
 50	10	8	8	10	9&lt;br /&gt;
 60	10	10	10	9	10&lt;br /&gt;
 70	12	10	9	12	11&lt;br /&gt;
 80	12	12	10	11	11&lt;br /&gt;
 90	12	14	9	13	12&lt;br /&gt;
 100	12	13	15	13	13&lt;br /&gt;
&lt;br /&gt;
Ploting the size vs the Average Height gives the following graph:&lt;br /&gt;
&amp;lt;HTML&amp;gt;&lt;br /&gt;
&amp;lt;img src=&amp;quot;http://img377.imageshack.us/img377/5729/image001gc2.png&amp;quot; border=&amp;quot;0&amp;quot;  /&amp;gt;&lt;br /&gt;
&amp;lt;/HTML&amp;gt;&lt;br /&gt;
Looking at the graph, it looks like it is a liner relationship. As the number of nodes grows,&lt;br /&gt;
&lt;br /&gt;
=== Task2 ===&lt;br /&gt;
&lt;br /&gt;
The Minimum function:&lt;br /&gt;
&lt;br /&gt;
 Node* minimum( Node* node ) {&lt;br /&gt;
     while (node-&amp;gt;left != empty)&lt;br /&gt;
 	node = node-&amp;gt;left;&lt;br /&gt;
 &lt;br /&gt;
     return node;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The Maximum function:&lt;br /&gt;
&lt;br /&gt;
 Node* maximum( Node* node ) {&lt;br /&gt;
     while (node-&amp;gt;right != empty)&lt;br /&gt;
 	node = node-&amp;gt;right;&lt;br /&gt;
 &lt;br /&gt;
     return node;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
To test it, i have used the following:&lt;br /&gt;
&lt;br /&gt;
 int main() {&lt;br /&gt;
     Node *newBST;&lt;br /&gt;
     newBST = makeRandomTree(5);&lt;br /&gt;
     show_tree(0, newBST);&lt;br /&gt;
     printf(&amp;quot;Minimum: %d\n&amp;quot;, minimum(newBST)-&amp;gt;key);&lt;br /&gt;
     printf(&amp;quot;Maximum: %d&amp;quot;, maximum(newBST)-&amp;gt;key);&lt;br /&gt;
     return 0;&lt;br /&gt;
 }&lt;/div&gt;</summary>
		<author><name>Mark</name></author>
	</entry>
</feed>