<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://www.wcipeg.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Simulation</id>
		<title>Simulation - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://www.wcipeg.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Simulation"/>
		<link rel="alternate" type="text/html" href="http://www.wcipeg.com/wiki/index.php?title=Simulation&amp;action=history"/>
		<updated>2026-05-09T11:36:11Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.25.2</generator>

	<entry>
		<id>http://www.wcipeg.com/wiki/index.php?title=Simulation&amp;diff=348&amp;oldid=prev</id>
		<title>Hpmv: /* Problem */</title>
		<link rel="alternate" type="text/html" href="http://www.wcipeg.com/wiki/index.php?title=Simulation&amp;diff=348&amp;oldid=prev"/>
				<updated>2010-05-08T02:51:07Z</updated>
		
		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Problem&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 02:51, 8 May 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;L3&quot; &gt;Line 3:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 3:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Example ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Example ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== Problem ===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== Problem ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Given M trees and the number of days each tree takes to grow a fruit, compute the total number of fruits after &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; days.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Given &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;math&amp;gt;&lt;/ins&gt;M&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/math&amp;gt; &lt;/ins&gt;trees and the number of days each tree takes to grow a fruit, compute the total number of fruits after &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; days.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== Solution ===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== Solution ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;For each tree &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;, keep a variable &amp;lt;math&amp;gt;K_i&amp;lt;/math&amp;gt; indicating the number of days it takes for the next fruit to grow. Simulate the situation day by day. On each day, decrease &amp;lt;math&amp;gt;K_i&amp;lt;/math&amp;gt; by 1 and increase the fruit count by the number of &amp;lt;math&amp;gt;K_i&amp;lt;/math&amp;gt;'s that equal zero, and reset these &amp;lt;math&amp;gt;K_i&amp;lt;/math&amp;gt;'s. Output the total sum at the end.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;For each tree &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;, keep a variable &amp;lt;math&amp;gt;K_i&amp;lt;/math&amp;gt; indicating the number of days it takes for the next fruit to grow. Simulate the situation day by day. On each day, decrease &amp;lt;math&amp;gt;K_i&amp;lt;/math&amp;gt; by 1 and increase the fruit count by the number of &amp;lt;math&amp;gt;K_i&amp;lt;/math&amp;gt;'s that equal zero, and reset these &amp;lt;math&amp;gt;K_i&amp;lt;/math&amp;gt;'s. Output the total sum at the end.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Hpmv</name></author>	</entry>

	<entry>
		<id>http://www.wcipeg.com/wiki/index.php?title=Simulation&amp;diff=347&amp;oldid=prev</id>
		<title>Hpmv: Created page with 'Simulation is a technique in programming where all events are processed in the order of occurrence. By translating real world logic into programming code, simulation speeds up ta…'</title>
		<link rel="alternate" type="text/html" href="http://www.wcipeg.com/wiki/index.php?title=Simulation&amp;diff=347&amp;oldid=prev"/>
				<updated>2010-05-08T02:50:37Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;#039;Simulation is a technique in programming where all events are processed in the order of occurrence. By translating real world logic into programming code, simulation speeds up ta…&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Simulation is a technique in programming where all events are processed in the order of occurrence. By translating real world logic into programming code, simulation speeds up tasks that may otherwise take a long time for human. Simulation does not provide alternative shortcuts to a solution; it simply speeds up the process.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
=== Problem ===&lt;br /&gt;
Given M trees and the number of days each tree takes to grow a fruit, compute the total number of fruits after &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; days.&lt;br /&gt;
=== Solution ===&lt;br /&gt;
For each tree &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;, keep a variable &amp;lt;math&amp;gt;K_i&amp;lt;/math&amp;gt; indicating the number of days it takes for the next fruit to grow. Simulate the situation day by day. On each day, decrease &amp;lt;math&amp;gt;K_i&amp;lt;/math&amp;gt; by 1 and increase the fruit count by the number of &amp;lt;math&amp;gt;K_i&amp;lt;/math&amp;gt;'s that equal zero, and reset these &amp;lt;math&amp;gt;K_i&amp;lt;/math&amp;gt;'s. Output the total sum at the end.&lt;br /&gt;
=== Analysis ===&lt;br /&gt;
This solution gives the correct answer, in &amp;lt;math&amp;gt;\mathcal{O}(MN)&amp;lt;/math&amp;gt; time. This is fine if &amp;lt;math&amp;gt;MN&amp;lt;/math&amp;gt; is small, but a better technique is required if &amp;lt;math&amp;gt;MN&amp;lt;/math&amp;gt; is large.&lt;br /&gt;
&lt;br /&gt;
== Characteristics ==&lt;br /&gt;
When a problem is logically simple and can be directly done by human, simulation is very likely the solution. When the bounds on variables are small, simulation is a quick, safe, and convincing technique. When run time is a concern, other techniques such as [[dynamic programming]] may be required.&lt;/div&gt;</summary>
		<author><name>Hpmv</name></author>	</entry>

	</feed>