<?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%3AMay_29</id>
	<title>SE250:May 29 - 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%3AMay_29"/>
	<link rel="alternate" type="text/html" href="https://wiki.kram.nz/index.php?title=SE250:May_29&amp;action=history"/>
	<updated>2026-06-04T16:29:21Z</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:May_29&amp;diff=4078&amp;oldid=prev</id>
		<title>Mark: 14 revision(s)</title>
		<link rel="alternate" type="text/html" href="https://wiki.kram.nz/index.php?title=SE250:May_29&amp;diff=4078&amp;oldid=prev"/>
		<updated>2008-11-03T05:18:35Z</updated>

		<summary type="html">&lt;p&gt;14 revision(s)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Example on State-space search==&lt;br /&gt;
Mark started off with a problem:&lt;br /&gt;
&lt;br /&gt;
 Start State = 1&lt;br /&gt;
 &lt;br /&gt;
 Legal Moves:&lt;br /&gt;
 x &amp;lt;- 2*x&lt;br /&gt;
 x &amp;lt;- x/3&lt;br /&gt;
 &lt;br /&gt;
 Goal State = 13&lt;br /&gt;
&lt;br /&gt;
NOTE: when deviding an interger, ignore the reminder.&lt;br /&gt;
&lt;br /&gt;
Solution in 9 moves&lt;br /&gt;
 state      move&lt;br /&gt;
 1          *2(deviding 3 would end up a 0 and stucked)&lt;br /&gt;
 2          *2( /3 would result a 1 which lead back to 1st state)&lt;br /&gt;
 4          *2&lt;br /&gt;
 8          *2&lt;br /&gt;
 16         /3&lt;br /&gt;
 5          *2&lt;br /&gt;
 10         *2&lt;br /&gt;
 20         *2&lt;br /&gt;
 40         /3&lt;br /&gt;
 13         YEAH&lt;br /&gt;
Then Mark showed us a graph on the problem.&lt;br /&gt;
&lt;br /&gt;
==General Search Procedure==&lt;br /&gt;
*Start of the root&lt;br /&gt;
*Check the 2 children to see if they contain the goal state or the state we have been to before&lt;br /&gt;
*Go to the node we have not been to before, and continue above till the goal state is reached&lt;br /&gt;
&lt;br /&gt;
Using this procedure we can get the smallest number of moves. This search procedure is called breath-first search.&lt;br /&gt;
&lt;br /&gt;
==Programming breath-first search==&lt;br /&gt;
*We need some data structure storing the nodes(states) we have been to&lt;br /&gt;
*It is easy if the database size is fixed-size, similar to the maze project last year&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Think about this in your own time.&amp;quot; Mark said.&lt;br /&gt;
&lt;br /&gt;
==Depth-first search==&lt;br /&gt;
*Suitable to use for search without infinite path.&lt;br /&gt;
*Using a stach to store the next move.&lt;br /&gt;
*Less Memory used.&lt;br /&gt;
*Easier to program, using recrusive function.&lt;br /&gt;
&lt;br /&gt;
==Problem For Tomorow==&lt;br /&gt;
Knapsack problem:&lt;br /&gt;
 given a bag weight limit W.&lt;br /&gt;
 different type of discrete obejects(plenty of each type).&lt;br /&gt;
 type i has value Vi, weight Wi.&lt;br /&gt;
 maximize total value chosen and not exceeding weight limit.&lt;br /&gt;
&lt;br /&gt;
Plus, find an exapmple where the &amp;quot;greedy&amp;quot; strategy(filling the bag with the highest value) fails.&lt;br /&gt;
&lt;br /&gt;
==Minutes==&lt;br /&gt;
*Minute-Taker: [[user:zyan057|zyan057]]&lt;br /&gt;
*Please let me know if anything is incorrect.&lt;/div&gt;</summary>
		<author><name>Mark</name></author>
	</entry>
</feed>