<?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%3Ajsmi233</id>
	<title>SE250:lab-6:jsmi233 - 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%3Ajsmi233"/>
	<link rel="alternate" type="text/html" href="https://wiki.kram.nz/index.php?title=SE250:lab-6:jsmi233&amp;action=history"/>
	<updated>2026-04-28T18:49:29Z</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:jsmi233&amp;diff=7170&amp;oldid=prev</id>
		<title>Mark: 4 revision(s)</title>
		<link rel="alternate" type="text/html" href="https://wiki.kram.nz/index.php?title=SE250:lab-6:jsmi233&amp;diff=7170&amp;oldid=prev"/>
		<updated>2008-11-03T05:20:06Z</updated>

		<summary type="html">&lt;p&gt;4 revision(s)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Binary Seach Trees ==&lt;br /&gt;
&lt;br /&gt;
For the first task, I investigated the relationship between Tree Size and Tree Height for a randomly generated Tree. I wrote some code to test the height of a random tree for tree sizes between one and one hundred. My results can be seen here: http://studwww.cs.auckland.ac.nz/~jsmi233/graph.jpg&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The graph shows that there is a strong relationship between the variables. Thanks to excel, I have found a rather fitting model for this relationship. Tree Height = 1.8378 * Tree Size ^ 0.4463&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the coding tasks, one key decision that I had to make for each function was whether to write it recursively. In some cases this was more clear cut than others. For the first of these however - the min and max functions - it was pretty much a toss of the coin, and I chose not to write them recursively. Here is my code:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Node* minimum( Node* node ) {&lt;br /&gt;
   	if (node == empty)&lt;br /&gt;
    		return empty;&lt;br /&gt;
    	for (; node-&amp;gt;left != empty; node = node-&amp;gt;left);&lt;br /&gt;
    		return node;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  Node* maximum( Node* node ) {&lt;br /&gt;
    if (node == empty)&lt;br /&gt;
    	return empty;&lt;br /&gt;
    for (; node-&amp;gt;right != empty; node = node-&amp;gt;right);&lt;br /&gt;
    return node;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The lookup function was fairly straight-forward. This one I implemented recursively:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Node* lookup( int key, Node* node ) {&lt;br /&gt;
    if (node == empty)&lt;br /&gt;
    	return empty;&lt;br /&gt;
    else if (key == node-&amp;gt;key)&lt;br /&gt;
    	return node;&lt;br /&gt;
    else if (key &amp;lt; node-&amp;gt;key)&lt;br /&gt;
    	return lookup(key, node-&amp;gt;left);&lt;br /&gt;
    else return lookup(key, node-&amp;gt;right);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
My first attempt at writing the next_pre function was insufficient, as I realised later. I had failed to handle the case where the node passed into the function was a leaf node but not the last leaf node. I made changes to fix this, but the function ended up looking quite messy.&lt;/div&gt;</summary>
		<author><name>Mark</name></author>
	</entry>
</feed>