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

		<summary type="html">&lt;p&gt;11 revision(s)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=Lab 6 : Binary Search Trees=&lt;br /&gt;
&lt;br /&gt;
lol... i do not take responsibility if my code is wrong and if you copy it and get it wrong your self... :)&lt;br /&gt;
i could use some help/suggestions here... lol..&lt;br /&gt;
&lt;br /&gt;
==Tasks==&lt;br /&gt;
===minimum===&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;
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;
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            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;
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;
...Fin...&lt;br /&gt;
out of time... lol...&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&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... im sure most of us were completely clueless... and 1 lab supervisor cannot help every student (specially when theres limited time...)...&lt;/div&gt;</summary>
		<author><name>Mark</name></author>
	</entry>
</feed>