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

		<summary type="html">&lt;p&gt;1 revision(s)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Tasks==&lt;br /&gt;
==minimum==&lt;br /&gt;
&lt;br /&gt;
the following code will &amp;quot;hopefully&amp;quot; find the minimum value of the binary search tree... unsure if its correcte (untested), but its the basic idea...&lt;br /&gt;
&lt;br /&gt;
 Node* minimum( Node* node ) {&lt;br /&gt;
    if (node == empty){&lt;br /&gt;
	return empty;&lt;br /&gt;
    }&lt;br /&gt;
    while ( (*node)-&amp;gt;left != empty){&lt;br /&gt;
	node = &amp;amp;(*node)-&amp;gt;left;&lt;br /&gt;
    }	&lt;br /&gt;
    return node;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==maximum==&lt;br /&gt;
&lt;br /&gt;
the following code will &amp;quot;hopefully&amp;quot; find the maximum value of the binary search tree... unsure if its correcte (untested), but its the basic idea...&lt;br /&gt;
&lt;br /&gt;
 Node* maximum( Node* node ) {&lt;br /&gt;
    if (node == empty){&lt;br /&gt;
	return empty;&lt;br /&gt;
    }&lt;br /&gt;
    while ( (*node)-&amp;gt;right != empty){&lt;br /&gt;
	node = &amp;amp;(*node)-&amp;gt;right;&lt;br /&gt;
    }	&lt;br /&gt;
    return node;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==lookup==&lt;br /&gt;
&lt;br /&gt;
the following code will &amp;quot;hopefully&amp;quot; find the node of the given key from the binary search tree... unsure if its correct (untested), but its the basic idea...&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;
    }&lt;br /&gt;
    if (key &amp;lt; (*node)-&amp;gt;key){&lt;br /&gt;
	return (lookup(key, (*node)-&amp;gt;left));&lt;br /&gt;
    }&lt;br /&gt;
    else if (key &amp;gt; (*node)-&amp;gt;key){&lt;br /&gt;
	return (lookup(key, (*node)-&amp;gt;right));&lt;br /&gt;
    }&lt;br /&gt;
     else if (key == (*node)-&amp;gt;key){&lt;br /&gt;
	return node;&lt;br /&gt;
    }&lt;br /&gt;
 //now this leaves onething out... what to do if the key isnt in the tree.. :S (would wnd up with                                  &lt;br /&gt;
 an endless loop...&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==next_prev==&lt;br /&gt;
&lt;br /&gt;
Im assuming this means the next value/node on the binary tree (from, the given one)... code is basically as follows, but not tested, not fully functioning... hehe... question wasent really clear.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Node* next_pre( Node* node ) {&lt;br /&gt;
    if (node == empty){&lt;br /&gt;
	return empty;&lt;br /&gt;
    }&lt;br /&gt;
    if ( (*node)-&amp;gt;right == empty){&lt;br /&gt;
	return node;&lt;br /&gt;
    }&lt;br /&gt;
    else{&lt;br /&gt;
	node = (*node)-&amp;gt;right;&lt;br /&gt;
	return (minimum(node));&lt;br /&gt;
    }&lt;br /&gt;
	    &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==prev_pre==&lt;br /&gt;
&lt;br /&gt;
Im assuming this means the previous value/node on the binary tree (from, the given one)... code is basically as follows, but not tested, not fully functioning... hehe... question wasent really clear...&lt;br /&gt;
&lt;br /&gt;
 Node* prev_pre( Node* node ) {&lt;br /&gt;
    if (node == empty){&lt;br /&gt;
	return empty;&lt;br /&gt;
    }&lt;br /&gt;
    if ( (*node)-&amp;gt;left == empty){&lt;br /&gt;
	return node;&lt;br /&gt;
    }&lt;br /&gt;
    else{&lt;br /&gt;
	node = (*node)-&amp;gt;left;&lt;br /&gt;
	return (maximum(node));&lt;br /&gt;
    }&lt;br /&gt;
	    &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
&lt;br /&gt;
Would be nice if we knew what we were doing. we knew the functionality of the binary trees, but we were never thought HOW to actually make it function. would be nice if we had a lecture on it before the lab next time.&lt;/div&gt;</summary>
		<author><name>Mark</name></author>
	</entry>
</feed>