<?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-8%3Aapra102</id>
	<title>SE250:lab-8:apra102 - 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-8%3Aapra102"/>
	<link rel="alternate" type="text/html" href="https://wiki.kram.nz/index.php?title=SE250:lab-8:apra102&amp;action=history"/>
	<updated>2026-04-27T11:21:37Z</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-8:apra102&amp;diff=8068&amp;oldid=prev</id>
		<title>Mark: 17 revision(s)</title>
		<link rel="alternate" type="text/html" href="https://wiki.kram.nz/index.php?title=SE250:lab-8:apra102&amp;diff=8068&amp;oldid=prev"/>
		<updated>2008-11-03T05:20:26Z</updated>

		<summary type="html">&lt;p&gt;17 revision(s)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Task 2==&lt;br /&gt;
Hmmm first i downloaded the wrong code and struggled for some time. After I realized and get the actual one i tried creating the new function and running it but then it came up with so many errors.&lt;br /&gt;
I showed my errors to the tutor she said that the &amp;#039;&amp;#039;&amp;#039;error function&amp;#039;&amp;#039;&amp;#039; code should be before the &amp;#039;&amp;#039;&amp;#039;expect&amp;#039;&amp;#039;&amp;#039; function. And the other one is to delete the &amp;#039;&amp;#039;&amp;#039;i&amp;#039;&amp;#039;&amp;#039; from&amp;#039;&amp;#039;&amp;#039; strcimp&amp;#039;&amp;#039;&amp;#039;. Finally it worked. When i used Visual Studio by creating my main construct,it did not work in the Visual Studio then i used Cygwin Drive it worked. My main function is as follows.&lt;br /&gt;
&lt;br /&gt;
 int main(void){&lt;br /&gt;
 	 ParseTree* t= mkNode(&amp;#039;-&amp;#039;, mkNode(&amp;#039;-&amp;#039;, mkNode(&amp;#039;a&amp;#039;,0),mkNode(&amp;#039;b&amp;#039;,0),0),0);&lt;br /&gt;
 	 prefix_tree(t);&lt;br /&gt;
 	 tree_to_graph(t,&amp;quot;tree_to_graph.jpg&amp;quot;);&lt;br /&gt;
 	 return 0;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
Output:&lt;br /&gt;
 -(-(a b))&lt;br /&gt;
&lt;br /&gt;
==Task 3==&lt;br /&gt;
First thing to know in this task is to know what is &amp;#039;&amp;#039;&amp;#039;?&amp;#039;&amp;#039;&amp;#039; means? That is ternary node. Means which has 3 nodes. I drew the tree in my book first. I felt a bit hard to figure out that we should go from end. Once i figure out how the first part i felt little comfort and then i continued to code. First i coded for small part &amp;#039;&amp;#039;&amp;#039;?(&amp;gt;(+(a b) c)&amp;#039;&amp;#039;&amp;#039; same way i coded for &amp;#039;&amp;#039;&amp;#039;*(z +(y b))&amp;#039;&amp;#039;&amp;#039; then i combined both of them. By breaking the whole thing in to parts and combining them finally is easy than trying to code for the whole thing.&lt;br /&gt;
code i made is:&lt;br /&gt;
&lt;br /&gt;
 int main(void){&lt;br /&gt;
 	ParseTree* t= mkNode(&amp;#039;-&amp;#039;, mkNode(&amp;#039;-&amp;#039;, mkNode(&amp;#039;a&amp;#039;,0),mkNode(&amp;#039;b&amp;#039;,0),0),0);&lt;br /&gt;
 	ParseTree* n= &lt;br /&gt;
 		mkNode(&amp;#039;?&amp;#039;,mkNode(&amp;#039;&amp;gt;&amp;#039;,mkNode(&amp;#039;+&amp;#039;,mkNode(&amp;#039;a&amp;#039;,0),mkNode(&amp;#039;b&amp;#039;,0),0),mkNode(&amp;#039;c&amp;#039;,0),0),&lt;br /&gt;
 		mkNode(&amp;#039;*&amp;#039;,mkNode(&amp;#039;z&amp;#039;,0),mkNode(&amp;#039;+&amp;#039;,mkNode(&amp;#039;y&amp;#039;,0),mkNode(&amp;#039;b&amp;#039;,0),0),&lt;br /&gt;
 		mkNode(&amp;#039;?&amp;#039;,mkNode(&amp;#039;=&amp;#039;,mkNode(&amp;#039;a&amp;#039;,0),mkNode(&amp;#039;2&amp;#039;,0),0),&lt;br /&gt;
 		mkNode(&amp;#039;-&amp;#039;,mkNode(&amp;#039;x&amp;#039;,0),mkNode(&amp;#039;y&amp;#039;,0),0),&lt;br /&gt;
 		mkNode(&amp;#039;-&amp;#039;,mkNode(&amp;#039;y&amp;#039;,0),mkNode(&amp;#039;x&amp;#039;,0),0),0),0),0);&lt;br /&gt;
 	prefix_tree(n);&lt;br /&gt;
 	tree_to_graph(n,&amp;quot;new_tree_to_graph.jpg&amp;quot;);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Out put: Which I got&lt;br /&gt;
&lt;br /&gt;
 ?(&amp;gt;(+(a b) c) *(z +(y b) ? (=(a 2) -(x y) -(y x))))&lt;br /&gt;
&lt;br /&gt;
It suppose it be&lt;br /&gt;
&lt;br /&gt;
 ?(&amp;gt;(+(a b) c) *(z +(y b)) ?(=(a 2) -(x y) -(y x)))&lt;br /&gt;
&lt;br /&gt;
I have no idea why there is an extra bracket. I dont know where should change my code to get that correct.&lt;br /&gt;
I came up to here. But the out put of this code is not the one which it suppose to be. I worked on it for a long time but could not figure it out. Will be happy if some one help me knowing what is wrong with the code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://img174.imageshack.us/my.php?image=newtreetographwk4.jpg ParsingTree]&lt;br /&gt;
&lt;br /&gt;
Yay... Later when i worked on that i just chalged them around and it works. Present code is&lt;br /&gt;
&lt;br /&gt;
 int main(void){&lt;br /&gt;
 	ParseTree* t= mkNode(&amp;#039;-&amp;#039;, mkNode(&amp;#039;-&amp;#039;, mkNode(&amp;#039;a&amp;#039;,0),mkNode(&amp;#039;b&amp;#039;,0),0),0);&lt;br /&gt;
 	ParseTree* n= &lt;br /&gt;
 		mkNode(&amp;#039;?&amp;#039;,mkNode(&amp;#039;&amp;gt;&amp;#039;,mkNode(&amp;#039;+&amp;#039;,mkNode(&amp;#039;a&amp;#039;,0),mkNode(&amp;#039;b&amp;#039;,0),0),mkNode(&amp;#039;c&amp;#039;,0),0),&lt;br /&gt;
 		mkNode(&amp;#039;?&amp;#039;,mkNode(&amp;#039;=&amp;#039;,mkNode(&amp;#039;a&amp;#039;,0),mkNode(&amp;#039;2&amp;#039;,0),0),&lt;br /&gt;
 		mkNode(&amp;#039;-&amp;#039;,mkNode(&amp;#039;x&amp;#039;,0),mkNode(&amp;#039;y&amp;#039;,0),0),&lt;br /&gt;
 		mkNode(&amp;#039;-&amp;#039;,mkNode(&amp;#039;y&amp;#039;,0),mkNode(&amp;#039;x&amp;#039;,0),0),0),&lt;br /&gt;
 		mkNode(&amp;#039;*&amp;#039;,mkNode(&amp;#039;z&amp;#039;,0),mkNode(&amp;#039;+&amp;#039;,mkNode(&amp;#039;y&amp;#039;,0),mkNode(&amp;#039;b&amp;#039;,0),0),0),0);&lt;br /&gt;
 	prefix_tree(n);&lt;br /&gt;
 	tree_to_graph(n,&amp;quot;new_tree_to_graph.jpg&amp;quot;);&lt;br /&gt;
 	return 0;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Out Put:&lt;br /&gt;
&lt;br /&gt;
 ?(&amp;gt;(+(a b) c) *(z +(y b)) ?(=(a 2) -(x y) -(y x)))&lt;br /&gt;
&lt;br /&gt;
[http://img241.imageshack.us/my.php?image=newtreetographsi8.jpg NewParsingTree]&lt;br /&gt;
&lt;br /&gt;
==Task 4==&lt;br /&gt;
I drew the tree before coding.&lt;/div&gt;</summary>
		<author><name>Mark</name></author>
	</entry>
</feed>