<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="th">
	<id>https://theory.cpe.ku.ac.th/wiki/index.php?action=history&amp;feed=atom&amp;title=418531_%E0%B8%A0%E0%B8%B2%E0%B8%84%E0%B8%95%E0%B9%89%E0%B8%99_2552%2F%E0%B9%82%E0%B8%88%E0%B8%97%E0%B8%A2%E0%B9%8C%E0%B8%9B%E0%B8%B1%E0%B8%8D%E0%B8%AB%E0%B8%B2%E0%B8%AD%E0%B8%B1%E0%B8%A5%E0%B8%81%E0%B8%AD%E0%B8%A3%E0%B8%B4%E0%B8%97%E0%B8%B6%E0%B8%A1%E0%B9%81%E0%B8%9A%E0%B8%9A%E0%B8%95%E0%B8%B0%E0%B8%81%E0%B8%A5%E0%B8%B0_I%2F%E0%B9%80%E0%B8%89%E0%B8%A5%E0%B8%A2%E0%B8%82%E0%B9%89%E0%B8%AD_1</id>
	<title>418531 ภาคต้น 2552/โจทย์ปัญหาอัลกอริทึมแบบตะกละ I/เฉลยข้อ 1 - ประวัติรุ่นแก้ไข</title>
	<link rel="self" type="application/atom+xml" href="https://theory.cpe.ku.ac.th/wiki/index.php?action=history&amp;feed=atom&amp;title=418531_%E0%B8%A0%E0%B8%B2%E0%B8%84%E0%B8%95%E0%B9%89%E0%B8%99_2552%2F%E0%B9%82%E0%B8%88%E0%B8%97%E0%B8%A2%E0%B9%8C%E0%B8%9B%E0%B8%B1%E0%B8%8D%E0%B8%AB%E0%B8%B2%E0%B8%AD%E0%B8%B1%E0%B8%A5%E0%B8%81%E0%B8%AD%E0%B8%A3%E0%B8%B4%E0%B8%97%E0%B8%B6%E0%B8%A1%E0%B9%81%E0%B8%9A%E0%B8%9A%E0%B8%95%E0%B8%B0%E0%B8%81%E0%B8%A5%E0%B8%B0_I%2F%E0%B9%80%E0%B8%89%E0%B8%A5%E0%B8%A2%E0%B8%82%E0%B9%89%E0%B8%AD_1"/>
	<link rel="alternate" type="text/html" href="https://theory.cpe.ku.ac.th/wiki/index.php?title=418531_%E0%B8%A0%E0%B8%B2%E0%B8%84%E0%B8%95%E0%B9%89%E0%B8%99_2552/%E0%B9%82%E0%B8%88%E0%B8%97%E0%B8%A2%E0%B9%8C%E0%B8%9B%E0%B8%B1%E0%B8%8D%E0%B8%AB%E0%B8%B2%E0%B8%AD%E0%B8%B1%E0%B8%A5%E0%B8%81%E0%B8%AD%E0%B8%A3%E0%B8%B4%E0%B8%97%E0%B8%B6%E0%B8%A1%E0%B9%81%E0%B8%9A%E0%B8%9A%E0%B8%95%E0%B8%B0%E0%B8%81%E0%B8%A5%E0%B8%B0_I/%E0%B9%80%E0%B8%89%E0%B8%A5%E0%B8%A2%E0%B8%82%E0%B9%89%E0%B8%AD_1&amp;action=history"/>
	<updated>2026-04-29T02:03:38Z</updated>
	<subtitle>ประวัติรุ่นแก้ไขของหน้านี้ในวิกิ</subtitle>
	<generator>MediaWiki 1.33.1</generator>
	<entry>
		<id>https://theory.cpe.ku.ac.th/wiki/index.php?title=418531_%E0%B8%A0%E0%B8%B2%E0%B8%84%E0%B8%95%E0%B9%89%E0%B8%99_2552/%E0%B9%82%E0%B8%88%E0%B8%97%E0%B8%A2%E0%B9%8C%E0%B8%9B%E0%B8%B1%E0%B8%8D%E0%B8%AB%E0%B8%B2%E0%B8%AD%E0%B8%B1%E0%B8%A5%E0%B8%81%E0%B8%AD%E0%B8%A3%E0%B8%B4%E0%B8%97%E0%B8%B6%E0%B8%A1%E0%B9%81%E0%B8%9A%E0%B8%9A%E0%B8%95%E0%B8%B0%E0%B8%81%E0%B8%A5%E0%B8%B0_I/%E0%B9%80%E0%B8%89%E0%B8%A5%E0%B8%A2%E0%B8%82%E0%B9%89%E0%B8%AD_1&amp;diff=7525&amp;oldid=prev</id>
		<title>Cardcaptor เมื่อ 16:01, 18 กันยายน 2552</title>
		<link rel="alternate" type="text/html" href="https://theory.cpe.ku.ac.th/wiki/index.php?title=418531_%E0%B8%A0%E0%B8%B2%E0%B8%84%E0%B8%95%E0%B9%89%E0%B8%99_2552/%E0%B9%82%E0%B8%88%E0%B8%97%E0%B8%A2%E0%B9%8C%E0%B8%9B%E0%B8%B1%E0%B8%8D%E0%B8%AB%E0%B8%B2%E0%B8%AD%E0%B8%B1%E0%B8%A5%E0%B8%81%E0%B8%AD%E0%B8%A3%E0%B8%B4%E0%B8%97%E0%B8%B6%E0%B8%A1%E0%B9%81%E0%B8%9A%E0%B8%9A%E0%B8%95%E0%B8%B0%E0%B8%81%E0%B8%A5%E0%B8%B0_I/%E0%B9%80%E0%B8%89%E0%B8%A5%E0%B8%A2%E0%B8%82%E0%B9%89%E0%B8%AD_1&amp;diff=7525&amp;oldid=prev"/>
		<updated>2009-09-18T16:01:38Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;th&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;←รุ่นแก้ไขก่อนหน้า&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;รุ่นแก้ไขเมื่อ 16:01, 18 กันยายน 2552&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l3&quot; &gt;แถว 3:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;แถว 3:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;ให้ S เป็นวิธีการจัดของลงรถสักวิธีหนึ่ง สำหรับของชิ้นที่ &amp;lt;math&amp;gt;i \,&amp;lt;/math&amp;gt; เราให้ &amp;lt;math&amp;gt;c_i^S \,&amp;lt;/math&amp;gt; แทนหมายเลขของรถคันที่ของชิ้นที่ &amp;lt;math&amp;gt;i \,&amp;lt;/math&amp;gt; ถูกบรรจุ สังเกตว่า &amp;lt;math&amp;gt;c_i^S \,&amp;lt;/math&amp;gt; คือจำนวนรถที่ใช้ในการขนส่งของ &amp;lt;math&amp;gt;i \,&amp;lt;/math&amp;gt; ชิ้นแรก&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;ให้ S เป็นวิธีการจัดของลงรถสักวิธีหนึ่ง สำหรับของชิ้นที่ &amp;lt;math&amp;gt;i \,&amp;lt;/math&amp;gt; เราให้ &amp;lt;math&amp;gt;c_i^S \,&amp;lt;/math&amp;gt; แทนหมายเลขของรถคันที่ของชิ้นที่ &amp;lt;math&amp;gt;i \,&amp;lt;/math&amp;gt; ถูกบรรจุ สังเกตว่า &amp;lt;math&amp;gt;c_i^S \,&amp;lt;/math&amp;gt; คือจำนวนรถที่ใช้ในการขนส่งของ &amp;lt;math&amp;gt;i \,&amp;lt;/math&amp;gt; ชิ้นแรก&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; 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;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;ยกตัวอย่างเช่น &lt;/del&gt;สมมติว่ารถแต่ละคันสามารถบรรทุกน้ำหนักได้ 10 หน่วย และให้ ของชื้นที่ 1 มีน้ำหนัก 5 หน่วย ของชิ้นที่สองมีน้ำหนัก 2 หน่วย ของชิ้นที่ 3 มีน้ำหนัก 1 หน่วย และของชิ้นที่ 4 มีน้ำหนัก 9 หน่วย  &lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;blockquote&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;#039;&amp;#039;&amp;#039;ตัวอย่าง&amp;#039;&amp;#039;&amp;#039; &lt;/ins&gt;สมมติว่ารถแต่ละคันสามารถบรรทุกน้ำหนักได้ 10 หน่วย และให้ ของชื้นที่ 1 มีน้ำหนัก 5 หน่วย ของชิ้นที่สองมีน้ำหนัก 2 หน่วย ของชิ้นที่ 3 มีน้ำหนัก 1 หน่วย และของชิ้นที่ 4 มีน้ำหนัก 9 หน่วย  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;วิธีการบรรจุของลงรถของมีได้หลายวิธี เช่น สมมติให้ &amp;lt;math&amp;gt;S \,&amp;lt;/math&amp;gt; เป็นวิธีการบรรจุของลงรถให้แต่ละคันมีของเพียงแค่ชิ้นเดียว เราจะได้ว่าของชิ้นที่ 1 ลงรถหมายเลข 1 ของชิ้นที่สองลงรถหมายเลข 2 เช่นนี้ไปเรื่อยๆ ดังนั้นเราจะได้ว่า &amp;lt;math&amp;gt;c_1^S = 1 \,&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;c_2^S = 2 \,&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;c_3^S = 3 \,&amp;lt;/math&amp;gt;, และ &amp;lt;math&amp;gt;c_4^S = 4 \,&amp;lt;/math&amp;gt; เป็นค้น ถ้า &amp;lt;math&amp;gt;S \,&amp;lt;/math&amp;gt;  เป็นวิธีการส่งของลงรถโดยที่รถหมายเลข 1 มีของชิ้นที่ 1 และ 2 ส่วนรถหมายเลข 2 มีของชิ้นที่ 3 และ 4 เราจะได้ว่า &amp;lt;math&amp;gt;c_1^S = c_2^S = 1 \,&amp;lt;/math&amp;gt; และ &amp;lt;math&amp;gt;c_3^S = c_4^S = 2 \,&amp;lt;/math&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;วิธีการบรรจุของลงรถของมีได้หลายวิธี เช่น สมมติให้ &amp;lt;math&amp;gt;S \,&amp;lt;/math&amp;gt; เป็นวิธีการบรรจุของลงรถให้แต่ละคันมีของเพียงแค่ชิ้นเดียว เราจะได้ว่าของชิ้นที่ 1 ลงรถหมายเลข 1 ของชิ้นที่สองลงรถหมายเลข 2 เช่นนี้ไปเรื่อยๆ ดังนั้นเราจะได้ว่า &amp;lt;math&amp;gt;c_1^S = 1 \,&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;c_2^S = 2 \,&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;c_3^S = 3 \,&amp;lt;/math&amp;gt;, และ &amp;lt;math&amp;gt;c_4^S = 4 \,&amp;lt;/math&amp;gt; เป็นค้น ถ้า &amp;lt;math&amp;gt;S \,&amp;lt;/math&amp;gt;  เป็นวิธีการส่งของลงรถโดยที่รถหมายเลข 1 มีของชิ้นที่ 1 และ 2 ส่วนรถหมายเลข 2 มีของชิ้นที่ 3 และ 4 เราจะได้ว่า &amp;lt;math&amp;gt;c_1^S = c_2^S = 1 \,&amp;lt;/math&amp;gt; และ &amp;lt;math&amp;gt;c_3^S = c_4^S = 2 \,&amp;lt;/math&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/blockquote&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;ให้ &amp;lt;math&amp;gt;G \,&amp;lt;/math&amp;gt; เป็นวิธีการจัดของลงรถแบบ greedy ในโจทย์ และให้ &amp;lt;math&amp;gt;\mathrm{OPT} \,&amp;lt;/math&amp;gt; เป็นวิธีการจัดของลงรถที่ใช้รถจำนวนน้อยคันที่สุดเท่าที่จะเป็นไปได้ ดังนั้นเราทราบว่า &amp;lt;math&amp;gt;c_n^{\mathrm{OPT}} \leq c_n^G \,&amp;lt;/math&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;ให้ &amp;lt;math&amp;gt;G \,&amp;lt;/math&amp;gt; เป็นวิธีการจัดของลงรถแบบ greedy ในโจทย์ และให้ &amp;lt;math&amp;gt;\mathrm{OPT} \,&amp;lt;/math&amp;gt; เป็นวิธีการจัดของลงรถที่ใช้รถจำนวนน้อยคันที่สุดเท่าที่จะเป็นไปได้ ดังนั้นเราทราบว่า &amp;lt;math&amp;gt;c_n^{\mathrm{OPT}} \leq c_n^G \,&amp;lt;/math&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; 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;ในกรณีตัวอย่างข้างบน เราจะได้ว่า greedy algorithm จะบรรจุของชิ้นที่ 1, 2, และ 3 ลงในรถหมายเลข 1 และของชิ้นที่ 4 ลงในรถหมายเลข 2 ดังนั้น &amp;lt;math&amp;gt;c_1^G = c_2^G = c_3^G = 1 \,&amp;lt;/math&amp;gt; และ &amp;lt;math&amp;gt;c_4^G = 2 \,&amp;lt;/math&amp;gt; สำหรับตัวอย่างนี้ เราเห็นได้อย่างชัดเจนว่าต้องใช้รถอย่างน้อยสองคัน ดังนั้น greedy algorithm จึงใช้รถเป็นจำนวนน้อยที่สุดในกรณีนี้ แต่วิธีการจัดของลงรถบรรทุกให้ใช้รถเพียงแค่สองคันมีอยู่ได้หลายวิธี และ &amp;lt;math&amp;gt;\mathrm{OPT} \,&amp;lt;/math&amp;gt; จะเป็นวิธีไหนในวิธีการจัดแบบนั้นก็ได้ เช่น เราจะบอกว่า &amp;lt;math&amp;gt;\mathrm{OPT} \,&amp;lt;/math&amp;gt; คือ การจัดของทีใส่ของชิ้นที่ 1 และชิ้นที่ 2 ลงไปในรถคันที่ 1 และของชิ้นที่ 3 และ 4 ลงในรถคันที่ 2 ก็ได้ ดังนั้น &amp;lt;math&amp;gt;c_1^{\mathrm{OPT}} = c_2^{\mathrm{OPT}} = 1 \,&amp;lt;/math&amp;gt; และ &amp;lt;math&amp;gt;c_3^{\mathrm{OPT}} = c_4^{\mathrm{OPT}} = 2 \,&amp;lt;/math&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;blockquote&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;#039;&amp;#039;&amp;#039;ตัวอย่าง&amp;#039;&amp;#039;&amp;#039; &lt;/ins&gt;ในกรณีตัวอย่างข้างบน เราจะได้ว่า greedy algorithm จะบรรจุของชิ้นที่ 1, 2, และ 3 ลงในรถหมายเลข 1 และของชิ้นที่ 4 ลงในรถหมายเลข 2 ดังนั้น &amp;lt;math&amp;gt;c_1^G = c_2^G = c_3^G = 1 \,&amp;lt;/math&amp;gt; และ &amp;lt;math&amp;gt;c_4^G = 2 \,&amp;lt;/math&amp;gt; สำหรับตัวอย่างนี้ เราเห็นได้อย่างชัดเจนว่าต้องใช้รถอย่างน้อยสองคัน ดังนั้น greedy algorithm จึงใช้รถเป็นจำนวนน้อยที่สุดในกรณีนี้ แต่วิธีการจัดของลงรถบรรทุกให้ใช้รถเพียงแค่สองคันมีอยู่ได้หลายวิธี และ &amp;lt;math&amp;gt;\mathrm{OPT} \,&amp;lt;/math&amp;gt; จะเป็นวิธีไหนในวิธีการจัดแบบนั้นก็ได้ เช่น เราจะบอกว่า &amp;lt;math&amp;gt;\mathrm{OPT} \,&amp;lt;/math&amp;gt; คือ การจัดของทีใส่ของชิ้นที่ 1 และชิ้นที่ 2 ลงไปในรถคันที่ 1 และของชิ้นที่ 3 และ 4 ลงในรถคันที่ 2 ก็ได้ ดังนั้น &amp;lt;math&amp;gt;c_1^{\mathrm{OPT}} = c_2^{\mathrm{OPT}} = 1 \,&amp;lt;/math&amp;gt; และ &amp;lt;math&amp;gt;c_3^{\mathrm{OPT}} = c_4^{\mathrm{OPT}} = 2 \,&amp;lt;/math&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/blockquote&lt;/ins&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; 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;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;เราจะพิสูจน์ว่า &amp;lt;math&amp;gt;c_i^G \leq c_i^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; สำหรับ &amp;lt;math&amp;gt;i \,&amp;lt;/math&amp;gt; ทุกค่าที่ &amp;lt;math&amp;gt;1 \leq i \leq n \,&amp;lt;/math&amp;gt; ซึ่งถ้าเราพิสูจน์ข้อความนี้ได้แล้ว เราจะได้ว่า &amp;lt;math&amp;gt;c_n^G = c_n^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; และนั่นหมายความว่า greedy algorithm ใช้รถน้อยค้นที่สุดเท่าที่จะเป็นไปได้แล้ว&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; 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;การพิสูจน์ทำโดย strong induction บนตัวแปร i&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;hr /&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;#039;&amp;#039;&amp;#039;lemma 1:&amp;#039;&amp;#039;&amp;#039; &amp;lt;math&amp;gt;c_i^G \leq c_i^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; สำหรับ &amp;lt;math&amp;gt;i \,&amp;lt;/math&amp;gt; ทุกค่าที่ &amp;lt;math&amp;gt;1 \leq i \leq n \,&amp;lt;/math&amp;gt; &lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;#039;&amp;#039;&amp;#039;พิสูจน์:&amp;#039;&amp;#039;&amp;#039; &lt;/ins&gt;การพิสูจน์ทำโดย strong induction บนตัวแปร i&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;(Base Case) ในกรณีนี้ &amp;lt;math&amp;gt;i = 1 \,&amp;lt;/math&amp;gt; เราได้ว่า &amp;lt;math&amp;gt;c_1^G = 1 \leq c_1^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; (เนื่องจาก greedy algorithm จะจัดของชิ้นแรกใส่รถหมายเลข 1 เลย) ดังนั้น base case เป็นความจริง&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;(Base Case) ในกรณีนี้ &amp;lt;math&amp;gt;i = 1 \,&amp;lt;/math&amp;gt; เราได้ว่า &amp;lt;math&amp;gt;c_1^G = 1 \leq c_1^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; (เนื่องจาก greedy algorithm จะจัดของชิ้นแรกใส่รถหมายเลข 1 เลย) ดังนั้น base case เป็นความจริง&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l33&quot; &gt;แถว 33:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;แถว 39:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;ด้วยเหตุนี้ในการจัดของชิ้นที่ &amp;lt;math&amp;gt;i+1 \,&amp;lt;/math&amp;gt; ลงรถ จึงไม่มีทางเป็นไปได้ที่ greedy algorithm จะใช้จำนวนรถมากกว่า &amp;lt;math&amp;gt;\mathrm{OPT} \,&amp;lt;/math&amp;gt; เพราะ greedy algorithm จะจัดของชิ้นที่ &amp;lt;math&amp;gt;i+1 \,&amp;lt;/math&amp;gt; ลวรถหมายเลข &amp;lt;math&amp;gt;c_i^G \,&amp;lt;/math&amp;gt; ทันทีถ้ามีที่ว่างพอ กล่าวคือ &amp;lt;math&amp;gt;c_{i+1}^G \leq c_{i+1}^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;ด้วยเหตุนี้ในการจัดของชิ้นที่ &amp;lt;math&amp;gt;i+1 \,&amp;lt;/math&amp;gt; ลงรถ จึงไม่มีทางเป็นไปได้ที่ greedy algorithm จะใช้จำนวนรถมากกว่า &amp;lt;math&amp;gt;\mathrm{OPT} \,&amp;lt;/math&amp;gt; เพราะ greedy algorithm จะจัดของชิ้นที่ &amp;lt;math&amp;gt;i+1 \,&amp;lt;/math&amp;gt; ลวรถหมายเลข &amp;lt;math&amp;gt;c_i^G \,&amp;lt;/math&amp;gt; ทันทีถ้ามีที่ว่างพอ กล่าวคือ &amp;lt;math&amp;gt;c_{i+1}^G \leq c_{i+1}^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; 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;ดังนั้นเราสามารถสรุปได้ว่า &amp;lt;math&amp;gt;c_i^G \leq c_i^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; สำหรับ &amp;lt;math&amp;gt;i \,&amp;lt;/math&amp;gt; ทุกค่าที่ &amp;lt;math&amp;gt;1 \leq i \leq n \,&amp;lt;/math&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;เพราะฉะนั้น &lt;/del&gt;greedy algorithm &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;ในโจทย์จึงใช้รถจำนวนน้อยคันที่สุดเท่าที่จะเป็นไปได้&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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;lt;math&amp;gt;c_i^G \leq c_i^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; สำหรับ &amp;lt;math&amp;gt;i \,&amp;lt;/math&amp;gt; ทุกค่าที่ &amp;lt;math&amp;gt;1 \leq i \leq n \,&amp;lt;/math&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt; (จบการพิสูจน์ lemma 1)&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;hr/&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;จาก lemma 1 เราจะได้ว่า &amp;lt;math&amp;gt;c_n^G = c_n^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; ซึ่งหมายความว่า &lt;/ins&gt;greedy algorithm &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;ใช้รถน้อยค้นที่สุดเท่าที่จะเป็นไปได้แล้ว&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Cardcaptor</name></author>
		
	</entry>
	<entry>
		<id>https://theory.cpe.ku.ac.th/wiki/index.php?title=418531_%E0%B8%A0%E0%B8%B2%E0%B8%84%E0%B8%95%E0%B9%89%E0%B8%99_2552/%E0%B9%82%E0%B8%88%E0%B8%97%E0%B8%A2%E0%B9%8C%E0%B8%9B%E0%B8%B1%E0%B8%8D%E0%B8%AB%E0%B8%B2%E0%B8%AD%E0%B8%B1%E0%B8%A5%E0%B8%81%E0%B8%AD%E0%B8%A3%E0%B8%B4%E0%B8%97%E0%B8%B6%E0%B8%A1%E0%B9%81%E0%B8%9A%E0%B8%9A%E0%B8%95%E0%B8%B0%E0%B8%81%E0%B8%A5%E0%B8%B0_I/%E0%B9%80%E0%B8%89%E0%B8%A5%E0%B8%A2%E0%B8%82%E0%B9%89%E0%B8%AD_1&amp;diff=7493&amp;oldid=prev</id>
		<title>Cardcaptor เมื่อ 09:37, 18 กันยายน 2552</title>
		<link rel="alternate" type="text/html" href="https://theory.cpe.ku.ac.th/wiki/index.php?title=418531_%E0%B8%A0%E0%B8%B2%E0%B8%84%E0%B8%95%E0%B9%89%E0%B8%99_2552/%E0%B9%82%E0%B8%88%E0%B8%97%E0%B8%A2%E0%B9%8C%E0%B8%9B%E0%B8%B1%E0%B8%8D%E0%B8%AB%E0%B8%B2%E0%B8%AD%E0%B8%B1%E0%B8%A5%E0%B8%81%E0%B8%AD%E0%B8%A3%E0%B8%B4%E0%B8%97%E0%B8%B6%E0%B8%A1%E0%B9%81%E0%B8%9A%E0%B8%9A%E0%B8%95%E0%B8%B0%E0%B8%81%E0%B8%A5%E0%B8%B0_I/%E0%B9%80%E0%B8%89%E0%B8%A5%E0%B8%A2%E0%B8%82%E0%B9%89%E0%B8%AD_1&amp;diff=7493&amp;oldid=prev"/>
		<updated>2009-09-18T09:37:28Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;th&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;←รุ่นแก้ไขก่อนหน้า&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;รุ่นแก้ไขเมื่อ 09:37, 18 กันยายน 2552&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l29&quot; &gt;แถว 29:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;แถว 29:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;จากสมมติฐานของ induction เราทราบว่า &amp;lt;math&amp;gt;c_k^G \leq c_k^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; สำหรับค่า &amp;lt;math&amp;gt;k \,&amp;lt;/math&amp;gt; ทุกค่าที่ &amp;lt;math&amp;gt;1 \leq k \leq i \,&amp;lt;/math&amp;gt; ดังนั้นถ้า &amp;lt;math&amp;gt;c_k^G = c_i^G \,&amp;lt;/math&amp;gt; และเราจะได้ว่า &amp;lt;math&amp;gt;c_k^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; จะต้องมีค่าเท่ากับ &amp;lt;math&amp;gt;c_i^G \,&amp;lt;/math&amp;gt; ด้วยเสมอ เนื่องจาก &amp;lt;math&amp;gt;c_i^G = c_k^G \leq c_k^{\mathrm{OPT}} \leq c_i^{\mathrm{OPT}} \leq c_i^G \,&amp;lt;/math&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;จากสมมติฐานของ induction เราทราบว่า &amp;lt;math&amp;gt;c_k^G \leq c_k^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; สำหรับค่า &amp;lt;math&amp;gt;k \,&amp;lt;/math&amp;gt; ทุกค่าที่ &amp;lt;math&amp;gt;1 \leq k \leq i \,&amp;lt;/math&amp;gt; ดังนั้นถ้า &amp;lt;math&amp;gt;c_k^G = c_i^G \,&amp;lt;/math&amp;gt; และเราจะได้ว่า &amp;lt;math&amp;gt;c_k^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; จะต้องมีค่าเท่ากับ &amp;lt;math&amp;gt;c_i^G \,&amp;lt;/math&amp;gt; ด้วยเสมอ เนื่องจาก &amp;lt;math&amp;gt;c_i^G = c_k^G \leq c_k^{\mathrm{OPT}} \leq c_i^{\mathrm{OPT}} \leq c_i^G \,&amp;lt;/math&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; 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;เราจึงสามารถสรุปได้ว่า สำหรับของทุกชิ้นที่ greedy algorithm ใส่ลงในรถหมายเลข &amp;lt;math&amp;gt;c_i^G \,&amp;lt;/math&amp;gt; เราจะได้ว่า &amp;lt;math&amp;gt;\mathrm{OPT} \,&amp;lt;/math&amp;gt; ก็จะใส่มันลงในรถหมายเลข &amp;lt;math&amp;gt;c_i^G \,&amp;lt;/math&amp;gt; ด้วย เพราะฉะนั้น &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;math&amp;gt;&lt;/del&gt;greedy algorithm &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;\,&amp;lt;/math&amp;gt; &lt;/del&gt;จะทำให้รถคันที่ &amp;lt;math&amp;gt;c_i^G \,&amp;lt;/math&amp;gt; มีที่ว่างเหลือไม่น้อยกว่าที่ว่างที่เกิดจากวิธีการจัดของของ &amp;lt;math&amp;gt;\mathrm{OPT} \,&amp;lt;/math&amp;gt; เสมอ&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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;เราจึงสามารถสรุปได้ว่า สำหรับของทุกชิ้นที่ greedy algorithm ใส่ลงในรถหมายเลข &amp;lt;math&amp;gt;c_i^G \,&amp;lt;/math&amp;gt; เราจะได้ว่า &amp;lt;math&amp;gt;\mathrm{OPT} \,&amp;lt;/math&amp;gt; ก็จะใส่มันลงในรถหมายเลข &amp;lt;math&amp;gt;c_i^G \,&amp;lt;/math&amp;gt; ด้วย เพราะฉะนั้น greedy algorithm จะทำให้รถคันที่ &amp;lt;math&amp;gt;c_i^G \,&amp;lt;/math&amp;gt; มีที่ว่างเหลือไม่น้อยกว่าที่ว่างที่เกิดจากวิธีการจัดของของ &amp;lt;math&amp;gt;\mathrm{OPT} \,&amp;lt;/math&amp;gt; เสมอ&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;ด้วยเหตุนี้ในการจัดของชิ้นที่ &amp;lt;math&amp;gt;i+1 \,&amp;lt;/math&amp;gt; ลงรถ จึงไม่มีทางเป็นไปได้ที่ greedy algorithm จะใช้จำนวนรถมากกว่า &amp;lt;math&amp;gt;\mathrm{OPT} \,&amp;lt;/math&amp;gt; เพราะ greedy algorithm จะจัดของชิ้นที่ &amp;lt;math&amp;gt;i+1 \,&amp;lt;/math&amp;gt; ลวรถหมายเลข &amp;lt;math&amp;gt;c_i^G \,&amp;lt;/math&amp;gt; ทันทีถ้ามีที่ว่างพอ กล่าวคือ &amp;lt;math&amp;gt;c_{i+1}^G \leq c_{i+1}^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;ด้วยเหตุนี้ในการจัดของชิ้นที่ &amp;lt;math&amp;gt;i+1 \,&amp;lt;/math&amp;gt; ลงรถ จึงไม่มีทางเป็นไปได้ที่ greedy algorithm จะใช้จำนวนรถมากกว่า &amp;lt;math&amp;gt;\mathrm{OPT} \,&amp;lt;/math&amp;gt; เพราะ greedy algorithm จะจัดของชิ้นที่ &amp;lt;math&amp;gt;i+1 \,&amp;lt;/math&amp;gt; ลวรถหมายเลข &amp;lt;math&amp;gt;c_i^G \,&amp;lt;/math&amp;gt; ทันทีถ้ามีที่ว่างพอ กล่าวคือ &amp;lt;math&amp;gt;c_{i+1}^G \leq c_{i+1}^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;ดังนั้นเราสามารถสรุปได้ว่า &amp;lt;math&amp;gt;c_i^G \leq c_i^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; สำหรับ &amp;lt;math&amp;gt;i \,&amp;lt;/math&amp;gt; ทุกค่าที่ &amp;lt;math&amp;gt;1 \leq i \leq n \,&amp;lt;/math&amp;gt; เพราะฉะนั้น greedy algorithm ในโจทย์จึงใช้รถจำนวนน้อยคันที่สุดเท่าที่จะเป็นไปได้&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;ดังนั้นเราสามารถสรุปได้ว่า &amp;lt;math&amp;gt;c_i^G \leq c_i^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; สำหรับ &amp;lt;math&amp;gt;i \,&amp;lt;/math&amp;gt; ทุกค่าที่ &amp;lt;math&amp;gt;1 \leq i \leq n \,&amp;lt;/math&amp;gt; เพราะฉะนั้น greedy algorithm ในโจทย์จึงใช้รถจำนวนน้อยคันที่สุดเท่าที่จะเป็นไปได้&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Cardcaptor</name></author>
		
	</entry>
	<entry>
		<id>https://theory.cpe.ku.ac.th/wiki/index.php?title=418531_%E0%B8%A0%E0%B8%B2%E0%B8%84%E0%B8%95%E0%B9%89%E0%B8%99_2552/%E0%B9%82%E0%B8%88%E0%B8%97%E0%B8%A2%E0%B9%8C%E0%B8%9B%E0%B8%B1%E0%B8%8D%E0%B8%AB%E0%B8%B2%E0%B8%AD%E0%B8%B1%E0%B8%A5%E0%B8%81%E0%B8%AD%E0%B8%A3%E0%B8%B4%E0%B8%97%E0%B8%B6%E0%B8%A1%E0%B9%81%E0%B8%9A%E0%B8%9A%E0%B8%95%E0%B8%B0%E0%B8%81%E0%B8%A5%E0%B8%B0_I/%E0%B9%80%E0%B8%89%E0%B8%A5%E0%B8%A2%E0%B8%82%E0%B9%89%E0%B8%AD_1&amp;diff=7491&amp;oldid=prev</id>
		<title>Cardcaptor เมื่อ 09:35, 18 กันยายน 2552</title>
		<link rel="alternate" type="text/html" href="https://theory.cpe.ku.ac.th/wiki/index.php?title=418531_%E0%B8%A0%E0%B8%B2%E0%B8%84%E0%B8%95%E0%B9%89%E0%B8%99_2552/%E0%B9%82%E0%B8%88%E0%B8%97%E0%B8%A2%E0%B9%8C%E0%B8%9B%E0%B8%B1%E0%B8%8D%E0%B8%AB%E0%B8%B2%E0%B8%AD%E0%B8%B1%E0%B8%A5%E0%B8%81%E0%B8%AD%E0%B8%A3%E0%B8%B4%E0%B8%97%E0%B8%B6%E0%B8%A1%E0%B9%81%E0%B8%9A%E0%B8%9A%E0%B8%95%E0%B8%B0%E0%B8%81%E0%B8%A5%E0%B8%B0_I/%E0%B9%80%E0%B8%89%E0%B8%A5%E0%B8%A2%E0%B8%82%E0%B9%89%E0%B8%AD_1&amp;diff=7491&amp;oldid=prev"/>
		<updated>2009-09-18T09:35:01Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;th&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;←รุ่นแก้ไขก่อนหน้า&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;รุ่นแก้ไขเมื่อ 09:35, 18 กันยายน 2552&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;แถว 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;แถว 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;เราให้หมายเลขรถโดยให้รถคันแรกที่ออกจากกรุงเทพฯ เป็นรถหมายเลข 1 รถคันที่สองที่ออกจากกรุงเทพฯ เป็นรถหมายเลข 2 เช่นนี้ไปเรื่อยๆ&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;เราให้หมายเลขรถโดยให้รถคันแรกที่ออกจากกรุงเทพฯ เป็นรถหมายเลข 1 รถคันที่สองที่ออกจากกรุงเทพฯ เป็นรถหมายเลข 2 เช่นนี้ไปเรื่อยๆ&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; 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;ให้ S เป็นวิธีการจัดของลงรถสักวิธีหนึ่ง สำหรับของชิ้นที่ &amp;lt;math&amp;gt;i \,&amp;lt;/math&amp;gt; เราให้ &amp;lt;math&amp;gt;c_i^S \,&amp;lt;/math&amp;gt; แทนหมายเลขของรถคันที่ของชิ้นที่ &amp;lt;math&amp;gt;i \,&amp;lt;/math&amp;gt; ถูกบรรจุ สังเกตว่า &amp;lt;math&amp;gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;c_n&lt;/del&gt;^S \,&amp;lt;/math&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;คือจำนวนรถที่ใช้ในการขนส่งของทั้งหมด&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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;ให้ S เป็นวิธีการจัดของลงรถสักวิธีหนึ่ง สำหรับของชิ้นที่ &amp;lt;math&amp;gt;i \,&amp;lt;/math&amp;gt; เราให้ &amp;lt;math&amp;gt;c_i^S \,&amp;lt;/math&amp;gt; แทนหมายเลขของรถคันที่ของชิ้นที่ &amp;lt;math&amp;gt;i \,&amp;lt;/math&amp;gt; ถูกบรรจุ สังเกตว่า &amp;lt;math&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;c_i&lt;/ins&gt;^S \,&amp;lt;/math&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;คือจำนวนรถที่ใช้ในการขนส่งของ &amp;lt;math&amp;gt;i \,&amp;lt;/math&amp;gt; ชิ้นแรก&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;ยกตัวอย่างเช่น สมมติว่ารถแต่ละคันสามารถบรรทุกน้ำหนักได้ 10 หน่วย และให้ ของชื้นที่ 1 มีน้ำหนัก 5 หน่วย ของชิ้นที่สองมีน้ำหนัก 2 หน่วย ของชิ้นที่ 3 มีน้ำหนัก 1 หน่วย และของชิ้นที่ 4 มีน้ำหนัก 9 หน่วย  &lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;ยกตัวอย่างเช่น สมมติว่ารถแต่ละคันสามารถบรรทุกน้ำหนักได้ 10 หน่วย และให้ ของชื้นที่ 1 มีน้ำหนัก 5 หน่วย ของชิ้นที่สองมีน้ำหนัก 2 หน่วย ของชิ้นที่ 3 มีน้ำหนัก 1 หน่วย และของชิ้นที่ 4 มีน้ำหนัก 9 หน่วย  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l21&quot; &gt;แถว 21:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;แถว 21:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;พิจารณาการบรรจุของชิ้นที่ &amp;lt;math&amp;gt;i+1 \,&amp;lt;/math&amp;gt; ลงรถบรรทุก กรณีนี้มีความเป็นไปได้สองกรณี&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;พิจารณาการบรรจุของชิ้นที่ &amp;lt;math&amp;gt;i+1 \,&amp;lt;/math&amp;gt; ลงรถบรรทุก กรณีนี้มีความเป็นไปได้สองกรณี&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; 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;&amp;#039;&amp;#039;&amp;#039;กรณีที่ 1:&amp;#039;&amp;#039;&amp;#039; ถ้า &amp;lt;math&amp;gt;c_i^G &amp;lt; c_i^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; ซึ่งหมายความว่า greedy algorithm ใข้รถ&amp;#039;&amp;#039;น้อยกว่า&amp;#039;&amp;#039; &amp;lt;math&amp;gt;\mathrm{OPT} \,&amp;lt;/math&amp;gt; ในการส่งของ &amp;lt;math&amp;gt;i \,&amp;lt;/math&amp;gt; ชิ้นแรก &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;เราจะได้ว่าในการส่งของชิ้นที่ &lt;/del&gt;&amp;lt;math&amp;gt;i+1 \,&amp;lt;/math&amp;gt; greedy algorithm จะใช้รถไม่เกิน &amp;lt;math&amp;gt;c_{i}^G + 1 \,&amp;lt;/math&amp;gt; คัน (เนื่องจาก greedy algorithm อาจจะเอาของชิ้นที่ &amp;lt;math&amp;gt;i+1 \,&amp;lt;/math&amp;gt; ไปใส่ในรถคันใหม่) และ &amp;lt;math&amp;gt;\mathrm{OPT} \,&amp;lt;/math&amp;gt; จะต้องนำของชิ้นที่ &amp;lt;math&amp;gt;i+1 \,&amp;lt;/math&amp;gt; ไปใส่ในรถหมายเลข &amp;lt;math&amp;gt;c_i^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; หรือไม่ก็ &amp;lt;math&amp;gt;c_i^{\mathrm{OPT}}+1 \,&amp;lt;/math&amp;gt; ฉะนั้นเราจะได้ว่า &amp;lt;math&amp;gt;c_{i+1}^G \leq c_i^G+1 \leq c_i^{\mathrm{OPT}} \leq c_{i+1}^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; ตามต้องการ&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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;#039;&amp;#039;&amp;#039;กรณีที่ 1:&amp;#039;&amp;#039;&amp;#039; ถ้า &amp;lt;math&amp;gt;c_i^G &amp;lt; c_i^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; ซึ่งหมายความว่า greedy algorithm ใข้รถ&amp;#039;&amp;#039;น้อยกว่า&amp;#039;&amp;#039; &amp;lt;math&amp;gt;\mathrm{OPT} \,&amp;lt;/math&amp;gt; ในการส่งของ &amp;lt;math&amp;gt;i \,&amp;lt;/math&amp;gt; ชิ้นแรก &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;แล้วเราจะได้ว่าในการส่งของชิ้นที่ &lt;/ins&gt;&amp;lt;math&amp;gt;i+1 \,&amp;lt;/math&amp;gt; greedy algorithm จะใช้รถไม่เกิน &amp;lt;math&amp;gt;c_{i}^G + 1 \,&amp;lt;/math&amp;gt; คัน (เนื่องจาก greedy algorithm อาจจะเอาของชิ้นที่ &amp;lt;math&amp;gt;i+1 \,&amp;lt;/math&amp;gt; ไปใส่ในรถคันใหม่) และ &amp;lt;math&amp;gt;\mathrm{OPT} \,&amp;lt;/math&amp;gt; จะต้องนำของชิ้นที่ &amp;lt;math&amp;gt;i+1 \,&amp;lt;/math&amp;gt; ไปใส่ในรถหมายเลข &amp;lt;math&amp;gt;c_i^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; หรือไม่ก็ &amp;lt;math&amp;gt;c_i^{\mathrm{OPT}}+1 \,&amp;lt;/math&amp;gt; ฉะนั้นเราจะได้ว่า &amp;lt;math&amp;gt;c_{i+1}^G \leq c_i^G+1 \leq c_i^{\mathrm{OPT}} \leq c_{i+1}^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; ตามต้องการ&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;#039;&amp;#039;&amp;#039;กรณีที่ 2:&amp;#039;&amp;#039;&amp;#039; ถ้า &amp;lt;math&amp;gt;c_i^G = c_i^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; แล้วเราจะได้ว่าทั้ง greedy algorithm และ &amp;lt;math&amp;gt;\mathrm{OPT} \,&amp;lt;/math&amp;gt; ใส่ของชิ้นที่ &amp;lt;math&amp;gt;i \,&amp;lt;/math&amp;gt; ลงไปในรถหมายเลข &amp;lt;math&amp;gt;c_i^G \,&amp;lt;/math&amp;gt; เหมือนกัน เราจะพิสูจน์ว่าวิธีการจัดของของ greedy algorithm จะทำให้รถหมายเลข &amp;lt;math&amp;gt;c_i^G \,&amp;lt;/math&amp;gt; มีที่ว่างเหลือมากกว่า &amp;lt;math&amp;gt;\mathrm{OPT} \,&amp;lt;/math&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;พิจารณาของที่ถูกจัดให้อยู่ในรถหมายเลข &amp;lt;math&amp;gt;c_i^G \,&amp;lt;/math&amp;gt; ในกรณีของ greedy algorithm เราจะได้ว่ามันคือของชิ้นที่ &amp;lt;math&amp;gt;k \,&amp;lt;/math&amp;gt; ทุกชิ้นซึ่ง &amp;lt;math&amp;gt;c_k^G = c_i^G \,&amp;lt;/math&amp;gt; และในกรณีของ &amp;lt;math&amp;gt;\mathrm{OPT} \,&amp;lt;/math&amp;gt; มันคือของชิ้นที่ &amp;lt;math&amp;gt;k \,&amp;lt;/math&amp;gt; ทุกชิ้นที่ &amp;lt;math&amp;gt;c_k^{\mathrm{OPT}} = c_i^{\mathrm{OPT}} = c_i^G \,&amp;lt;/math&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;จากสมมติฐานของ induction เราทราบว่า &amp;lt;math&amp;gt;c_k^G \leq c_k^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; สำหรับค่า &amp;lt;math&amp;gt;k \,&amp;lt;/math&amp;gt; ทุกค่าที่ &amp;lt;math&amp;gt;1 \leq k \leq i \,&amp;lt;/math&amp;gt; ดังนั้นถ้า &amp;lt;math&amp;gt;c_k^G = c_i^G \,&amp;lt;/math&amp;gt; และเราจะได้ว่า &amp;lt;math&amp;gt;c_k^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; จะต้องมีค่าเท่ากับ &amp;lt;math&amp;gt;c_i^G \,&amp;lt;/math&amp;gt; ด้วยเสมอ เนื่องจาก &amp;lt;math&amp;gt;c_i^G = c_k^G \leq c_k^{\mathrm{OPT}} \leq c_i^{\mathrm{OPT}} \leq c_i^G \,&amp;lt;/math&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;เราจึงสามารถสรุปได้ว่า สำหรับของทุกชิ้นที่ greedy algorithm ใส่ลงในรถหมายเลข &amp;lt;math&amp;gt;c_i^G \,&amp;lt;/math&amp;gt; เราจะได้ว่า &amp;lt;math&amp;gt;\mathrm{OPT} \,&amp;lt;/math&amp;gt; ก็จะใส่มันลงในรถหมายเลข &amp;lt;math&amp;gt;c_i^G \,&amp;lt;/math&amp;gt; ด้วย เพราะฉะนั้น &amp;lt;math&amp;gt;greedy algorithm \,&amp;lt;/math&amp;gt; จะทำให้รถคันที่ &amp;lt;math&amp;gt;c_i^G \,&amp;lt;/math&amp;gt; มีที่ว่างเหลือไม่น้อยกว่าที่ว่างที่เกิดจากวิธีการจัดของของ &amp;lt;math&amp;gt;\mathrm{OPT} \,&amp;lt;/math&amp;gt; เสมอ&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;ด้วยเหตุนี้ในการจัดของชิ้นที่ &amp;lt;math&amp;gt;i+1 \,&amp;lt;/math&amp;gt; ลงรถ จึงไม่มีทางเป็นไปได้ที่ greedy algorithm จะใช้จำนวนรถมากกว่า &amp;lt;math&amp;gt;\mathrm{OPT} \,&amp;lt;/math&amp;gt; เพราะ greedy algorithm จะจัดของชิ้นที่ &amp;lt;math&amp;gt;i+1 \,&amp;lt;/math&amp;gt; ลวรถหมายเลข &amp;lt;math&amp;gt;c_i^G \,&amp;lt;/math&amp;gt; ทันทีถ้ามีที่ว่างพอ กล่าวคือ &amp;lt;math&amp;gt;c_{i+1}^G \leq c_{i+1}^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;ดังนั้นเราสามารถสรุปได้ว่า &amp;lt;math&amp;gt;c_i^G \leq c_i^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; สำหรับ &amp;lt;math&amp;gt;i \,&amp;lt;/math&amp;gt; ทุกค่าที่ &amp;lt;math&amp;gt;1 \leq i \leq n \,&amp;lt;/math&amp;gt; เพราะฉะนั้น greedy algorithm ในโจทย์จึงใช้รถจำนวนน้อยคันที่สุดเท่าที่จะเป็นไปได้&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Cardcaptor</name></author>
		
	</entry>
	<entry>
		<id>https://theory.cpe.ku.ac.th/wiki/index.php?title=418531_%E0%B8%A0%E0%B8%B2%E0%B8%84%E0%B8%95%E0%B9%89%E0%B8%99_2552/%E0%B9%82%E0%B8%88%E0%B8%97%E0%B8%A2%E0%B9%8C%E0%B8%9B%E0%B8%B1%E0%B8%8D%E0%B8%AB%E0%B8%B2%E0%B8%AD%E0%B8%B1%E0%B8%A5%E0%B8%81%E0%B8%AD%E0%B8%A3%E0%B8%B4%E0%B8%97%E0%B8%B6%E0%B8%A1%E0%B9%81%E0%B8%9A%E0%B8%9A%E0%B8%95%E0%B8%B0%E0%B8%81%E0%B8%A5%E0%B8%B0_I/%E0%B9%80%E0%B8%89%E0%B8%A5%E0%B8%A2%E0%B8%82%E0%B9%89%E0%B8%AD_1&amp;diff=7490&amp;oldid=prev</id>
		<title>Cardcaptor เมื่อ 09:12, 18 กันยายน 2552</title>
		<link rel="alternate" type="text/html" href="https://theory.cpe.ku.ac.th/wiki/index.php?title=418531_%E0%B8%A0%E0%B8%B2%E0%B8%84%E0%B8%95%E0%B9%89%E0%B8%99_2552/%E0%B9%82%E0%B8%88%E0%B8%97%E0%B8%A2%E0%B9%8C%E0%B8%9B%E0%B8%B1%E0%B8%8D%E0%B8%AB%E0%B8%B2%E0%B8%AD%E0%B8%B1%E0%B8%A5%E0%B8%81%E0%B8%AD%E0%B8%A3%E0%B8%B4%E0%B8%97%E0%B8%B6%E0%B8%A1%E0%B9%81%E0%B8%9A%E0%B8%9A%E0%B8%95%E0%B8%B0%E0%B8%81%E0%B8%A5%E0%B8%B0_I/%E0%B9%80%E0%B8%89%E0%B8%A5%E0%B8%A2%E0%B8%82%E0%B9%89%E0%B8%AD_1&amp;diff=7490&amp;oldid=prev"/>
		<updated>2009-09-18T09:12:53Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;th&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;←รุ่นแก้ไขก่อนหน้า&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;รุ่นแก้ไขเมื่อ 09:12, 18 กันยายน 2552&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l21&quot; &gt;แถว 21:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;แถว 21:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;พิจารณาการบรรจุของชิ้นที่ &amp;lt;math&amp;gt;i+1 \,&amp;lt;/math&amp;gt; ลงรถบรรทุก กรณีนี้มีความเป็นไปได้สองกรณี&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;พิจารณาการบรรจุของชิ้นที่ &amp;lt;math&amp;gt;i+1 \,&amp;lt;/math&amp;gt; ลงรถบรรทุก กรณีนี้มีความเป็นไปได้สองกรณี&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; 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;&amp;#039;&amp;#039;&amp;#039;กรณีที่ 1:&amp;#039;&amp;#039;&amp;#039; ถ้า &amp;lt;math&amp;gt;c_i^G &amp;lt; c_i^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;แล้วเราจะได้ว่า&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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;#039;&amp;#039;&amp;#039;กรณีที่ 1:&amp;#039;&amp;#039;&amp;#039; ถ้า &amp;lt;math&amp;gt;c_i^G &amp;lt; c_i^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;ซึ่งหมายความว่า greedy algorithm ใข้รถ&amp;#039;&amp;#039;น้อยกว่า&amp;#039;&amp;#039; &amp;lt;math&amp;gt;\mathrm{OPT} \,&amp;lt;/math&amp;gt; ในการส่งของ &amp;lt;math&amp;gt;i \,&amp;lt;/math&amp;gt; ชิ้นแรก เราจะได้ว่าในการส่งของชิ้นที่ &amp;lt;math&amp;gt;i+1 \,&amp;lt;/math&amp;gt; greedy algorithm จะใช้รถไม่เกิน &amp;lt;math&amp;gt;c_{i}^G + 1 \,&amp;lt;/math&amp;gt; คัน (เนื่องจาก greedy algorithm อาจจะเอาของชิ้นที่ &amp;lt;math&amp;gt;i+1 \,&amp;lt;/math&amp;gt; ไปใส่ในรถคันใหม่) และ &amp;lt;math&amp;gt;\mathrm{OPT} \,&amp;lt;/math&amp;gt; จะต้องนำของชิ้นที่ &amp;lt;math&amp;gt;i+1 \,&amp;lt;/math&amp;gt; ไปใส่ในรถหมายเลข &amp;lt;math&amp;gt;c_i^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; หรือไม่ก็ &amp;lt;math&amp;gt;c_i^{\mathrm{OPT}}+1 \,&amp;lt;/math&amp;gt; ฉะนั้นเราจะได้ว่า &amp;lt;math&amp;gt;c_{i+1}^G \leq c_i^G+1 \leq c_i^{\mathrm{OPT}} \leq c_{i+1}^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; ตามต้องการ&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Cardcaptor</name></author>
		
	</entry>
	<entry>
		<id>https://theory.cpe.ku.ac.th/wiki/index.php?title=418531_%E0%B8%A0%E0%B8%B2%E0%B8%84%E0%B8%95%E0%B9%89%E0%B8%99_2552/%E0%B9%82%E0%B8%88%E0%B8%97%E0%B8%A2%E0%B9%8C%E0%B8%9B%E0%B8%B1%E0%B8%8D%E0%B8%AB%E0%B8%B2%E0%B8%AD%E0%B8%B1%E0%B8%A5%E0%B8%81%E0%B8%AD%E0%B8%A3%E0%B8%B4%E0%B8%97%E0%B8%B6%E0%B8%A1%E0%B9%81%E0%B8%9A%E0%B8%9A%E0%B8%95%E0%B8%B0%E0%B8%81%E0%B8%A5%E0%B8%B0_I/%E0%B9%80%E0%B8%89%E0%B8%A5%E0%B8%A2%E0%B8%82%E0%B9%89%E0%B8%AD_1&amp;diff=7489&amp;oldid=prev</id>
		<title>Cardcaptor เมื่อ 09:07, 18 กันยายน 2552</title>
		<link rel="alternate" type="text/html" href="https://theory.cpe.ku.ac.th/wiki/index.php?title=418531_%E0%B8%A0%E0%B8%B2%E0%B8%84%E0%B8%95%E0%B9%89%E0%B8%99_2552/%E0%B9%82%E0%B8%88%E0%B8%97%E0%B8%A2%E0%B9%8C%E0%B8%9B%E0%B8%B1%E0%B8%8D%E0%B8%AB%E0%B8%B2%E0%B8%AD%E0%B8%B1%E0%B8%A5%E0%B8%81%E0%B8%AD%E0%B8%A3%E0%B8%B4%E0%B8%97%E0%B8%B6%E0%B8%A1%E0%B9%81%E0%B8%9A%E0%B8%9A%E0%B8%95%E0%B8%B0%E0%B8%81%E0%B8%A5%E0%B8%B0_I/%E0%B9%80%E0%B8%89%E0%B8%A5%E0%B8%A2%E0%B8%82%E0%B9%89%E0%B8%AD_1&amp;diff=7489&amp;oldid=prev"/>
		<updated>2009-09-18T09:07:42Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;th&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;←รุ่นแก้ไขก่อนหน้า&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;รุ่นแก้ไขเมื่อ 09:07, 18 กันยายน 2552&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l2&quot; &gt;แถว 2:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;แถว 2:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;ให้ S เป็นวิธีการจัดของลงรถสักวิธีหนึ่ง สำหรับของชิ้นที่ &amp;lt;math&amp;gt;i \,&amp;lt;/math&amp;gt; เราให้ &amp;lt;math&amp;gt;c_i^S \,&amp;lt;/math&amp;gt; แทนหมายเลขของรถคันที่ของชิ้นที่ &amp;lt;math&amp;gt;i \,&amp;lt;/math&amp;gt; ถูกบรรจุ สังเกตว่า &amp;lt;math&amp;gt;c_n^S \,&amp;lt;/math&amp;gt; คือจำนวนรถที่ใช้ในการขนส่งของทั้งหมด&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;ให้ S เป็นวิธีการจัดของลงรถสักวิธีหนึ่ง สำหรับของชิ้นที่ &amp;lt;math&amp;gt;i \,&amp;lt;/math&amp;gt; เราให้ &amp;lt;math&amp;gt;c_i^S \,&amp;lt;/math&amp;gt; แทนหมายเลขของรถคันที่ของชิ้นที่ &amp;lt;math&amp;gt;i \,&amp;lt;/math&amp;gt; ถูกบรรจุ สังเกตว่า &amp;lt;math&amp;gt;c_n^S \,&amp;lt;/math&amp;gt; คือจำนวนรถที่ใช้ในการขนส่งของทั้งหมด&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;ยกตัวอย่างเช่น สมมติว่ารถแต่ละคันสามารถบรรทุกน้ำหนักได้ 10 หน่วย และให้ ของชื้นที่ 1 มีน้ำหนัก 5 หน่วย ของชิ้นที่สองมีน้ำหนัก 2 หน่วย ของชิ้นที่ 3 มีน้ำหนัก 1 หน่วย และของชิ้นที่ 4 มีน้ำหนัก 9 หน่วย &lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;วิธีการบรรจุของลงรถของมีได้หลายวิธี เช่น สมมติให้ &amp;lt;math&amp;gt;S \,&amp;lt;/math&amp;gt; เป็นวิธีการบรรจุของลงรถให้แต่ละคันมีของเพียงแค่ชิ้นเดียว เราจะได้ว่าของชิ้นที่ 1 ลงรถหมายเลข 1 ของชิ้นที่สองลงรถหมายเลข 2 เช่นนี้ไปเรื่อยๆ ดังนั้นเราจะได้ว่า &amp;lt;math&amp;gt;c_1^S = 1 \,&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;c_2^S = 2 \,&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;c_3^S = 3 \,&amp;lt;/math&amp;gt;, และ &amp;lt;math&amp;gt;c_4^S = 4 \,&amp;lt;/math&amp;gt; เป็นค้น ถ้า &amp;lt;math&amp;gt;S \,&amp;lt;/math&amp;gt;  เป็นวิธีการส่งของลงรถโดยที่รถหมายเลข 1 มีของชิ้นที่ 1 และ 2 ส่วนรถหมายเลข 2 มีของชิ้นที่ 3 และ 4 เราจะได้ว่า &amp;lt;math&amp;gt;c_1^S = c_2^S = 1 \,&amp;lt;/math&amp;gt; และ &amp;lt;math&amp;gt;c_3^S = c_4^S = 2 \,&amp;lt;/math&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;ให้ &amp;lt;math&amp;gt;G \,&amp;lt;/math&amp;gt; เป็นวิธีการจัดของลงรถแบบ greedy ในโจทย์ และให้ &amp;lt;math&amp;gt;\mathrm{OPT} \,&amp;lt;/math&amp;gt; เป็นวิธีการจัดของลงรถที่ใช้รถจำนวนน้อยคันที่สุดเท่าที่จะเป็นไปได้ ดังนั้นเราทราบว่า &amp;lt;math&amp;gt;c_n^{\mathrm{OPT}} \leq c_n^G \,&amp;lt;/math&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;ให้ &amp;lt;math&amp;gt;G \,&amp;lt;/math&amp;gt; เป็นวิธีการจัดของลงรถแบบ greedy ในโจทย์ และให้ &amp;lt;math&amp;gt;\mathrm{OPT} \,&amp;lt;/math&amp;gt; เป็นวิธีการจัดของลงรถที่ใช้รถจำนวนน้อยคันที่สุดเท่าที่จะเป็นไปได้ ดังนั้นเราทราบว่า &amp;lt;math&amp;gt;c_n^{\mathrm{OPT}} \leq c_n^G \,&amp;lt;/math&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;ในกรณีตัวอย่างข้างบน เราจะได้ว่า greedy algorithm จะบรรจุของชิ้นที่ 1, 2, และ 3 ลงในรถหมายเลข 1 และของชิ้นที่ 4 ลงในรถหมายเลข 2 ดังนั้น &amp;lt;math&amp;gt;c_1^G = c_2^G = c_3^G = 1 \,&amp;lt;/math&amp;gt; และ &amp;lt;math&amp;gt;c_4^G = 2 \,&amp;lt;/math&amp;gt; สำหรับตัวอย่างนี้ เราเห็นได้อย่างชัดเจนว่าต้องใช้รถอย่างน้อยสองคัน ดังนั้น greedy algorithm จึงใช้รถเป็นจำนวนน้อยที่สุดในกรณีนี้ แต่วิธีการจัดของลงรถบรรทุกให้ใช้รถเพียงแค่สองคันมีอยู่ได้หลายวิธี และ &amp;lt;math&amp;gt;\mathrm{OPT} \,&amp;lt;/math&amp;gt; จะเป็นวิธีไหนในวิธีการจัดแบบนั้นก็ได้ เช่น เราจะบอกว่า &amp;lt;math&amp;gt;\mathrm{OPT} \,&amp;lt;/math&amp;gt; คือ การจัดของทีใส่ของชิ้นที่ 1 และชิ้นที่ 2 ลงไปในรถคันที่ 1 และของชิ้นที่ 3 และ 4 ลงในรถคันที่ 2 ก็ได้ ดังนั้น &amp;lt;math&amp;gt;c_1^{\mathrm{OPT}} = c_2^{\mathrm{OPT}} = 1 \,&amp;lt;/math&amp;gt; และ &amp;lt;math&amp;gt;c_3^{\mathrm{OPT}} = c_4^{\mathrm{OPT}} = 2 \,&amp;lt;/math&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;เราจะพิสูจน์ว่า &amp;lt;math&amp;gt;c_i^G \leq c_i^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; สำหรับ &amp;lt;math&amp;gt;i \,&amp;lt;/math&amp;gt; ทุกค่าที่ &amp;lt;math&amp;gt;1 \leq i \leq n \,&amp;lt;/math&amp;gt; ซึ่งถ้าเราพิสูจน์ข้อความนี้ได้แล้ว เราจะได้ว่า &amp;lt;math&amp;gt;c_n^G = c_n^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; และนั่นหมายความว่า greedy algorithm ใช้รถน้อยค้นที่สุดเท่าที่จะเป็นไปได้แล้ว&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;เราจะพิสูจน์ว่า &amp;lt;math&amp;gt;c_i^G \leq c_i^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; สำหรับ &amp;lt;math&amp;gt;i \,&amp;lt;/math&amp;gt; ทุกค่าที่ &amp;lt;math&amp;gt;1 \leq i \leq n \,&amp;lt;/math&amp;gt; ซึ่งถ้าเราพิสูจน์ข้อความนี้ได้แล้ว เราจะได้ว่า &amp;lt;math&amp;gt;c_n^G = c_n^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; และนั่นหมายความว่า greedy algorithm ใช้รถน้อยค้นที่สุดเท่าที่จะเป็นไปได้แล้ว&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l9&quot; &gt;แถว 9:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;แถว 15:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;การพิสูจน์ทำโดย strong induction บนตัวแปร i&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;การพิสูจน์ทำโดย strong induction บนตัวแปร i&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; 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;(Base Case) ในกรณีนี้ &amp;lt;math&amp;gt;i = 1 \,&amp;lt;/math&amp;gt; เราได้ว่า &amp;lt;math&amp;gt;c_1^G = 1 \leq c_1^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; ดังนั้น base case เป็นความจริง&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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;(Base Case) ในกรณีนี้ &amp;lt;math&amp;gt;i = 1 \,&amp;lt;/math&amp;gt; เราได้ว่า &amp;lt;math&amp;gt;c_1^G = 1 \leq c_1^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;(เนื่องจาก greedy algorithm จะจัดของชิ้นแรกใส่รถหมายเลข 1 เลย) &lt;/ins&gt;ดังนั้น base case เป็นความจริง&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;(Induction Case) สมมติว่ามีจำนวนเต็ม &amp;lt;math&amp;gt;i \geq 1 \,&amp;lt;/math&amp;gt; ที่ทำให้ &amp;lt;math&amp;gt;c_k^G \leq c_k^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; สำหรับค่า &amp;lt;math&amp;gt;k \,&amp;lt;/math&amp;gt; ทุกค่าที่ &amp;lt;math&amp;gt;1 \leq k \leq i \,&amp;lt;/math&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;(Induction Case) สมมติว่ามีจำนวนเต็ม &amp;lt;math&amp;gt;i \geq 1 \,&amp;lt;/math&amp;gt; ที่ทำให้ &amp;lt;math&amp;gt;c_k^G \leq c_k^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; สำหรับค่า &amp;lt;math&amp;gt;k \,&amp;lt;/math&amp;gt; ทุกค่าที่ &amp;lt;math&amp;gt;1 \leq k \leq i \,&amp;lt;/math&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Cardcaptor</name></author>
		
	</entry>
	<entry>
		<id>https://theory.cpe.ku.ac.th/wiki/index.php?title=418531_%E0%B8%A0%E0%B8%B2%E0%B8%84%E0%B8%95%E0%B9%89%E0%B8%99_2552/%E0%B9%82%E0%B8%88%E0%B8%97%E0%B8%A2%E0%B9%8C%E0%B8%9B%E0%B8%B1%E0%B8%8D%E0%B8%AB%E0%B8%B2%E0%B8%AD%E0%B8%B1%E0%B8%A5%E0%B8%81%E0%B8%AD%E0%B8%A3%E0%B8%B4%E0%B8%97%E0%B8%B6%E0%B8%A1%E0%B9%81%E0%B8%9A%E0%B8%9A%E0%B8%95%E0%B8%B0%E0%B8%81%E0%B8%A5%E0%B8%B0_I/%E0%B9%80%E0%B8%89%E0%B8%A5%E0%B8%A2%E0%B8%82%E0%B9%89%E0%B8%AD_1&amp;diff=7488&amp;oldid=prev</id>
		<title>Cardcaptor: หน้าที่ถูกสร้างด้วย &#039;เราให้หมายเลขรถโดยให้รถคันแรกที่ออกจากกรุงเทพฯ…&#039;</title>
		<link rel="alternate" type="text/html" href="https://theory.cpe.ku.ac.th/wiki/index.php?title=418531_%E0%B8%A0%E0%B8%B2%E0%B8%84%E0%B8%95%E0%B9%89%E0%B8%99_2552/%E0%B9%82%E0%B8%88%E0%B8%97%E0%B8%A2%E0%B9%8C%E0%B8%9B%E0%B8%B1%E0%B8%8D%E0%B8%AB%E0%B8%B2%E0%B8%AD%E0%B8%B1%E0%B8%A5%E0%B8%81%E0%B8%AD%E0%B8%A3%E0%B8%B4%E0%B8%97%E0%B8%B6%E0%B8%A1%E0%B9%81%E0%B8%9A%E0%B8%9A%E0%B8%95%E0%B8%B0%E0%B8%81%E0%B8%A5%E0%B8%B0_I/%E0%B9%80%E0%B8%89%E0%B8%A5%E0%B8%A2%E0%B8%82%E0%B9%89%E0%B8%AD_1&amp;diff=7488&amp;oldid=prev"/>
		<updated>2009-09-18T08:49:16Z</updated>

		<summary type="html">&lt;p&gt;หน้าที่ถูกสร้างด้วย &amp;#039;เราให้หมายเลขรถโดยให้รถคันแรกที่ออกจากกรุงเทพฯ…&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;หน้าใหม่&lt;/b&gt;&lt;/p&gt;&lt;div&gt;เราให้หมายเลขรถโดยให้รถคันแรกที่ออกจากกรุงเทพฯ เป็นรถหมายเลข 1 รถคันที่สองที่ออกจากกรุงเทพฯ เป็นรถหมายเลข 2 เช่นนี้ไปเรื่อยๆ&lt;br /&gt;
&lt;br /&gt;
ให้ S เป็นวิธีการจัดของลงรถสักวิธีหนึ่ง สำหรับของชิ้นที่ &amp;lt;math&amp;gt;i \,&amp;lt;/math&amp;gt; เราให้ &amp;lt;math&amp;gt;c_i^S \,&amp;lt;/math&amp;gt; แทนหมายเลขของรถคันที่ของชิ้นที่ &amp;lt;math&amp;gt;i \,&amp;lt;/math&amp;gt; ถูกบรรจุ สังเกตว่า &amp;lt;math&amp;gt;c_n^S \,&amp;lt;/math&amp;gt; คือจำนวนรถที่ใช้ในการขนส่งของทั้งหมด&lt;br /&gt;
&lt;br /&gt;
ให้ &amp;lt;math&amp;gt;G \,&amp;lt;/math&amp;gt; เป็นวิธีการจัดของลงรถแบบ greedy ในโจทย์ และให้ &amp;lt;math&amp;gt;\mathrm{OPT} \,&amp;lt;/math&amp;gt; เป็นวิธีการจัดของลงรถที่ใช้รถจำนวนน้อยคันที่สุดเท่าที่จะเป็นไปได้ ดังนั้นเราทราบว่า &amp;lt;math&amp;gt;c_n^{\mathrm{OPT}} \leq c_n^G \,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
เราจะพิสูจน์ว่า &amp;lt;math&amp;gt;c_i^G \leq c_i^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; สำหรับ &amp;lt;math&amp;gt;i \,&amp;lt;/math&amp;gt; ทุกค่าที่ &amp;lt;math&amp;gt;1 \leq i \leq n \,&amp;lt;/math&amp;gt; ซึ่งถ้าเราพิสูจน์ข้อความนี้ได้แล้ว เราจะได้ว่า &amp;lt;math&amp;gt;c_n^G = c_n^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; และนั่นหมายความว่า greedy algorithm ใช้รถน้อยค้นที่สุดเท่าที่จะเป็นไปได้แล้ว&lt;br /&gt;
&lt;br /&gt;
การพิสูจน์ทำโดย strong induction บนตัวแปร i&lt;br /&gt;
&lt;br /&gt;
(Base Case) ในกรณีนี้ &amp;lt;math&amp;gt;i = 1 \,&amp;lt;/math&amp;gt; เราได้ว่า &amp;lt;math&amp;gt;c_1^G = 1 \leq c_1^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; ดังนั้น base case เป็นความจริง&lt;br /&gt;
&lt;br /&gt;
(Induction Case) สมมติว่ามีจำนวนเต็ม &amp;lt;math&amp;gt;i \geq 1 \,&amp;lt;/math&amp;gt; ที่ทำให้ &amp;lt;math&amp;gt;c_k^G \leq c_k^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; สำหรับค่า &amp;lt;math&amp;gt;k \,&amp;lt;/math&amp;gt; ทุกค่าที่ &amp;lt;math&amp;gt;1 \leq k \leq i \,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
พิจารณาการบรรจุของชิ้นที่ &amp;lt;math&amp;gt;i+1 \,&amp;lt;/math&amp;gt; ลงรถบรรทุก กรณีนี้มีความเป็นไปได้สองกรณี&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;กรณีที่ 1:&amp;#039;&amp;#039;&amp;#039; ถ้า &amp;lt;math&amp;gt;c_i^G &amp;lt; c_i^{\mathrm{OPT}} \,&amp;lt;/math&amp;gt; แล้วเราจะได้ว่า&lt;/div&gt;</summary>
		<author><name>Cardcaptor</name></author>
		
	</entry>
</feed>