<?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_7</id>
	<title>418531 ภาคต้น 2552/โจทย์ปัญหาอัลกอริทึมแบบตะกละ I/เฉลยข้อ 7 - ประวัติรุ่นแก้ไข</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_7"/>
	<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_7&amp;action=history"/>
	<updated>2026-04-30T01:09:06Z</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_7&amp;diff=7558&amp;oldid=prev</id>
		<title>Aoy: /* การพิสูจน์ความถูกต้องของอัลกอริทึม */</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_7&amp;diff=7558&amp;oldid=prev"/>
		<updated>2009-09-21T13:09:40Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;การพิสูจน์ความถูกต้องของอัลกอริทึม&lt;/span&gt;&lt;/span&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;รุ่นแก้ไขเมื่อ 13:09, 21 กันยายน 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;/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;#039;&amp;#039;การพิสูจน์ความถูกต้องของอัลกอริทึม&amp;#039;&amp;#039;==&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;#039;&amp;#039;การพิสูจน์ความถูกต้องของอัลกอริทึม&amp;#039;&amp;#039;==&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;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; G=\{i_1,i_2,...,i_k \} \, &amp;lt;/math&amp;gt; เป็นเซตของผู้ตรวจงานที่ได้จาก greedy algorithm ข้างต้น และ &amp;lt;math&amp;gt; OPT=\{j_1,j_2,...,j_m \} \, &amp;lt;/math&amp;gt; เป็นเซตของผู้ตรวจงานที่ได้จาก optimal algorithm (&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;อัลกอริทึมสำหรับการแก้ปัญหาข้างต้นที่ให้เซตของผู้ตรวจงานที่มีขนาดน้อยที่สุด&lt;/del&gt;) เราจะทำการพิสูจน์โดยบอกว่า &amp;lt;math&amp;gt; k = m \,&amp;lt;/math&amp;gt; สังเกตว่า เนื่องจาก &amp;lt;math&amp;gt; OPT \, &amp;lt;/math&amp;gt; เป็นคำตอบที่ดีที่สุด ดังนั้น &amp;lt;math&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;k &lt;/del&gt;\leq &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;m &lt;/del&gt;\,&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; G=\{i_1,i_2,...,i_k \} \, &amp;lt;/math&amp;gt; เป็นเซตของผู้ตรวจงานที่ได้จาก greedy algorithm ข้างต้น และ &amp;lt;math&amp;gt; OPT=\{j_1,j_2,...,j_m \} \, &amp;lt;/math&amp;gt; เป็นเซตของผู้ตรวจงานที่ได้จาก optimal algorithm (&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;อัลกอริทึมสำหรับการแก้ปัญหาข้างต้นที่ให้เซตของผู้ตรวจงานที่มีจำนวนน้อยที่สุด&lt;/ins&gt;) เราจะทำการพิสูจน์โดยบอกว่า &amp;lt;math&amp;gt; k = m \,&amp;lt;/math&amp;gt; สังเกตว่า เนื่องจาก &amp;lt;math&amp;gt; OPT \, &amp;lt;/math&amp;gt; เป็นคำตอบที่ดีที่สุด ดังนั้น &amp;lt;math&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;m &lt;/ins&gt;\leq &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;k &lt;/ins&gt;\,&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; 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; 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;#039;&amp;#039;&amp;#039;lemma:&amp;#039;&amp;#039;&amp;#039;สำหรับ &amp;lt;math&amp;gt; r \leq &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;k &lt;/del&gt;\,&amp;lt;/math&amp;gt; ใด ๆ แล้ว &amp;lt;math&amp;gt; f(i_r) \geq f(j_r) \,&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;lemma:&amp;#039;&amp;#039;&amp;#039;สำหรับ &amp;lt;math&amp;gt; r \leq &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;m &lt;/ins&gt;\,&amp;lt;/math&amp;gt; ใด ๆ แล้ว &amp;lt;math&amp;gt; f(i_r) \geq f(j_r) \,&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;#039;&amp;#039;&amp;#039;พิสูจน์:&amp;#039;&amp;#039;&amp;#039;ทำการพิสูจน์โดย induction บน r กรณี base case &amp;lt;math&amp;gt; r=1 \, &amp;lt;/math&amp;gt; เนื่องจาก greedy algorithm เลือกคนงานที่มีเวลาเลิกงานช้าที่สุดที่ overlap กับคนงานที่มีเวลาเลิกงานน้อยที่สุดที่กำลังพิจารณาในเซต &amp;lt;math&amp;gt; S \, &amp;lt;/math&amp;gt; เป็นผู้ตรวจงาน ดังนั้น &amp;lt;math&amp;gt; f(i_1) \geq f(j_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;#039;&amp;#039;&amp;#039;พิสูจน์:&amp;#039;&amp;#039;&amp;#039;ทำการพิสูจน์โดย induction บน r กรณี base case &amp;lt;math&amp;gt; r=1 \, &amp;lt;/math&amp;gt; เนื่องจาก greedy algorithm เลือกคนงานที่มีเวลาเลิกงานช้าที่สุดที่ overlap กับคนงานที่มีเวลาเลิกงานน้อยที่สุดที่กำลังพิจารณาในเซต &amp;lt;math&amp;gt; S \, &amp;lt;/math&amp;gt; เป็นผู้ตรวจงาน ดังนั้น &amp;lt;math&amp;gt; f(i_1) \geq f(j_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;lt;math&amp;gt; r &amp;gt; 1 \, &amp;lt;/math&amp;gt; สมมติให้ข้อความที่ต้องการพิสูจน์เป็นจริงสำหรับค่า &amp;lt;math&amp;gt; r-1 \, &amp;lt;/math&amp;gt; นั่นคือ &amp;lt;math&amp;gt; f(i_{r-1}) \geq f(j_{r-1}) \, &amp;lt;/math&amp;gt; ต้องการพิสูจน์ว่า &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;สำหรับค่า &lt;/del&gt;&amp;lt;math&amp;gt; f(i_r) \geq f(j_r) \, &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;lt;math&amp;gt; r &amp;gt; 1 \, &amp;lt;/math&amp;gt; สมมติให้ข้อความที่ต้องการพิสูจน์เป็นจริงสำหรับค่า &amp;lt;math&amp;gt; r-1 \, &amp;lt;/math&amp;gt; นั่นคือ &amp;lt;math&amp;gt; f(i_{r-1}) \geq f(j_{r-1}) \, &amp;lt;/math&amp;gt; ต้องการพิสูจน์ว่า &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt; &lt;/ins&gt;&amp;lt;math&amp;gt; f(i_r) \geq f(j_r) \, &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; f(i_r) &amp;lt; f(j_r) \,&amp;lt;/math&amp;gt; พิจารณาการที่ greedy algorithm เลือกผู้ตรวจงานถึงคนที่ &amp;lt;math&amp;gt; i_{r-1} \, &amp;lt;/math&amp;gt; แสดงว่าต้องมีคนงานคนหนึ่งให้เป็นคนที่ &amp;lt;math&amp;gt; k \, &amp;lt;/math&amp;gt; ที่มีเวลาเริ่มงานทีหลังผู้ตรวจงานคนที่ &amp;lt;math&amp;gt; i_{r-1} \, &amp;lt;/math&amp;gt; นี้ นั่นคือ &amp;lt;math&amp;gt; s_k &amp;gt; f(i_{r-1}) \,&amp;lt;/math&amp;gt; เราจะได้ว่าเวลาการทำงานของคนงานคนที่ &amp;lt;math&amp;gt; k \,&amp;lt;/math&amp;gt; นี้จะต้อง overlap กับผู้ตรวจงานคนที่ &amp;lt;math&amp;gt; j_r \, &amp;lt;/math&amp;gt; ของ &amp;lt;math&amp;gt; OPT \, &amp;lt;/math&amp;gt; ด้วย เพราะไม่เช่นนั้นคนที่ &amp;lt;math&amp;gt; k \, &amp;lt;/math&amp;gt; นี้ก็จะไม่มีผู้ตรวจงานคนไหน ตรวจงานเค้าได้ (ไม่เป็นไปตามเงื่อนไขของบริษัท) แต่เนื่องจาก greedy algorithm เลือกผู้ตรวจงานเป็นคนงานคนที่มีเวลาเลิกงานช้าที่สุด และในที่นี้ greedy algorithm เลือกคนที่ &amp;lt;math&amp;gt; i_r \,&amp;lt;/math&amp;gt; จึงเกิดข้อขัดแย้งที่ว่า &amp;lt;math&amp;gt; f(i_r) &amp;lt; f(j_r) \,&amp;lt;/math&amp;gt; ดังนั้นเราสามารถสรุปได้ว่า &amp;lt;math&amp;gt; f(i_r) \geq f(j_r) \,&amp;lt;/math&amp;gt; สำหรับ &amp;lt;math&amp;gt; r \leq &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;k &lt;/del&gt;\,&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;lt;math&amp;gt; f(i_r) &amp;lt; f(j_r) \,&amp;lt;/math&amp;gt; พิจารณาการที่ greedy algorithm เลือกผู้ตรวจงานถึงคนที่ &amp;lt;math&amp;gt; i_{r-1} \, &amp;lt;/math&amp;gt; แสดงว่าต้องมีคนงานคนหนึ่งให้เป็นคนที่ &amp;lt;math&amp;gt; k \, &amp;lt;/math&amp;gt; ที่มีเวลาเริ่มงานทีหลังผู้ตรวจงานคนที่ &amp;lt;math&amp;gt; i_{r-1} \, &amp;lt;/math&amp;gt; นี้ นั่นคือ &amp;lt;math&amp;gt; s_k &amp;gt; f(i_{r-1}) \,&amp;lt;/math&amp;gt; เราจะได้ว่าเวลาการทำงานของคนงานคนที่ &amp;lt;math&amp;gt; k \,&amp;lt;/math&amp;gt; นี้จะต้อง overlap กับผู้ตรวจงานคนที่ &amp;lt;math&amp;gt; j_r \, &amp;lt;/math&amp;gt; ของ &amp;lt;math&amp;gt; OPT \, &amp;lt;/math&amp;gt; ด้วย เพราะไม่เช่นนั้นคนที่ &amp;lt;math&amp;gt; k \, &amp;lt;/math&amp;gt; นี้ก็จะไม่มีผู้ตรวจงานคนไหน ตรวจงานเค้าได้ (ไม่เป็นไปตามเงื่อนไขของบริษัท) แต่เนื่องจาก greedy algorithm เลือกผู้ตรวจงานเป็นคนงานคนที่มีเวลาเลิกงานช้าที่สุด และในที่นี้ greedy algorithm เลือกคนที่ &amp;lt;math&amp;gt; i_r \,&amp;lt;/math&amp;gt; จึงเกิดข้อขัดแย้งที่ว่า &amp;lt;math&amp;gt; f(i_r) &amp;lt; f(j_r) \,&amp;lt;/math&amp;gt; ดังนั้นเราสามารถสรุปได้ว่า &amp;lt;math&amp;gt; f(i_r) \geq f(j_r) \,&amp;lt;/math&amp;gt; สำหรับ &amp;lt;math&amp;gt; r \leq &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;m &lt;/ins&gt;\,&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;#039;&amp;#039;&amp;#039;ทฤษฎีบท:&amp;#039;&amp;#039;&amp;#039; Greedy algorithm ใช้จำนวนผู้ตรวจงานน้อยที่สุดเท่าที่จะเป็นไปได้ กล่าวคือ &amp;lt;math&amp;gt;  k = m \,&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;#039;&amp;#039;&amp;#039;ทฤษฎีบท:&amp;#039;&amp;#039;&amp;#039; Greedy algorithm ใช้จำนวนผู้ตรวจงานน้อยที่สุดเท่าที่จะเป็นไปได้ กล่าวคือ &amp;lt;math&amp;gt;  k = m \,&amp;lt;/math&amp;gt;&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-l37&quot; &gt;แถว 37:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;แถว 37:&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;#039;&amp;#039;&amp;#039;พิสูจน์:&amp;#039;&amp;#039;&amp;#039; สมมติเพื่อให้เกิดข้อขัดแย้งว่า &amp;lt;math&amp;gt; m &amp;lt; k \,&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;#039;&amp;#039;&amp;#039;พิสูจน์:&amp;#039;&amp;#039;&amp;#039; สมมติเพื่อให้เกิดข้อขัดแย้งว่า &amp;lt;math&amp;gt; m &amp;lt; k \,&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; OPT \, &amp;lt;/math&amp;gt; เพิ่มคนงานคนที่ &amp;lt;math&amp;gt; j_m \, &amp;lt;/math&amp;gt; เข้าไปเป็นผู้ตรวจงาน เนื่องจากผู้ตรวจงาน &amp;lt;math&amp;gt; j_1,j_2,...,j_m \, &amp;lt;/math&amp;gt; ตรวจงานคนงานได้ครบทุกคนตามเงื่อนไขของบริษัทแล้ว แสดงว่าไม่มีคนงานคนไหนที่มีเวลาทำงานไม่ overlap กับผู้ตรวจงาน &amp;lt;math&amp;gt; m \, &amp;lt;/math&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;ในวิธีการของ &lt;/del&gt;&amp;lt;math&amp;gt; OPT \,&amp;lt;/math&amp;gt; และจาก lemma เราได้ว่า &amp;lt;math&amp;gt; f(i_r) \geq f(j_r) \,&amp;lt;/math&amp;gt; จึงได้ว่าไม่มีคนงานคนไหนที่ที่มีเวลาทำงานไม่ overlap กับผู้ตรวจงานคนที่ &amp;lt;math&amp;gt; i_m \,&amp;lt;/math&amp;gt; ด้วย แต่การที่ greedy algorithm ยังเพิ่มผู้ตรวจงานคนที่ &amp;lt;math&amp;gt; i_{m+1} \,&amp;lt;/math&amp;gt; เข้าไปอีก แสดงว่า greedy algorithm ยังทำงานไม่จบ ทั้ง ๆ ที่ควรจบได้แล้ว เพราะคนงานทุกคนมีผู้ตรวจงานที่มีเวลา overlap กับตนเองแล้ว จึงเกิดข้อขัดแย้ง  &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; OPT \, &amp;lt;/math&amp;gt; เพิ่มคนงานคนที่ &amp;lt;math&amp;gt; j_m \, &amp;lt;/math&amp;gt; เข้าไปเป็นผู้ตรวจงาน เนื่องจากผู้ตรวจงาน &amp;lt;math&amp;gt; j_1,j_2,...,j_m \, &amp;lt;/math&amp;gt; ตรวจงานคนงานได้ครบทุกคนตามเงื่อนไขของบริษัทแล้ว แสดงว่าไม่มีคนงานคนไหนที่มีเวลาทำงานไม่ overlap กับผู้ตรวจงาน &amp;lt;math&amp;gt; m \, &amp;lt;/math&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;คนในวิธีการของ &lt;/ins&gt;&amp;lt;math&amp;gt; OPT \,&amp;lt;/math&amp;gt; และจาก lemma เราได้ว่า &amp;lt;math&amp;gt; f(i_r) \geq f(j_r) \,&amp;lt;/math&amp;gt; จึงได้ว่าไม่มีคนงานคนไหนที่ที่มีเวลาทำงานไม่ overlap กับผู้ตรวจงานคนที่ &amp;lt;math&amp;gt; i_m \,&amp;lt;/math&amp;gt; ด้วย แต่การที่ greedy algorithm ยังเพิ่มผู้ตรวจงานคนที่ &amp;lt;math&amp;gt; i_{m+1} \,&amp;lt;/math&amp;gt; เข้าไปอีก แสดงว่า greedy algorithm ยังทำงานไม่จบ ทั้ง ๆ ที่ควรจบได้แล้ว เพราะคนงานทุกคนมีผู้ตรวจงานที่มีเวลา overlap กับตนเองแล้ว จึงเกิดข้อขัดแย้ง  &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;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;/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;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;พิจารณาเวลาที่ greedy algorithm เพิ่งจะปักเสาต้นที่ &amp;lt;math&amp;gt;k \,&amp;lt;/math&amp;gt; ไป เราพบว่าบ้านทุกบ้านจะต้องถูกครอบคลุมด้วยเสา &amp;lt;math&amp;gt;\ell \,&amp;lt;/math&amp;gt; ต้นที่ปักไปแล้วตามการให้เหตุผลข้างต้น แต่การที่ &amp;lt;math&amp;gt;k &amp;gt; \ell \,&amp;lt;/math&amp;gt; แสดงว่า greedy algorithm ยังทำงานต่อไปทั้งทที่มันควรจะหยุดการทำงานตั้งแต่ตอนที่ปักเสาต้นที่ &amp;lt;math&amp;gt;\ell \,&amp;lt;/math&amp;gt; ไปแล้ว เกิดข้อขัดแย้ง&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;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; k = m \,&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; k = m \,&amp;lt;/math&amp;gt; และ greedy algorithm ใช้จำนวนผู้ตรวจงานน้อยที่สุดเท่าที่จะเป็นไปได้&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Aoy</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_7&amp;diff=7557&amp;oldid=prev</id>
		<title>Aoy: /* การพิสูจน์ความถูกต้องของอัลกอริทึม */</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_7&amp;diff=7557&amp;oldid=prev"/>
		<updated>2009-09-21T13:02:36Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;การพิสูจน์ความถูกต้องของอัลกอริทึม&lt;/span&gt;&lt;/span&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;รุ่นแก้ไขเมื่อ 13:02, 21 กันยายน 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-l23&quot; &gt;แถว 23:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;แถว 23:&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;จะใช้เทคนิค greedy algorithm นำหน้าเสมอ ดังนี้ ให้ &amp;lt;math&amp;gt; G=\{i_1,i_2,...,i_k \} \, &amp;lt;/math&amp;gt; เป็นเซตของผู้ตรวจงานที่ได้จาก greedy algorithm ข้างต้น และ &amp;lt;math&amp;gt; OPT=\{j_1,j_2,...,j_m \} \, &amp;lt;/math&amp;gt; เป็นเซตของผู้ตรวจงานที่ได้จาก optimal algorithm (อัลกอริทึมสำหรับการแก้ปัญหาข้างต้นที่ให้เซตของผู้ตรวจงานที่มีขนาดน้อยที่สุด) เราจะทำการพิสูจน์โดยบอกว่า &amp;lt;math&amp;gt; k = m \,&amp;lt;/math&amp;gt; สังเกตว่า เนื่องจาก &amp;lt;math&amp;gt; OPT \, &amp;lt;/math&amp;gt; เป็นคำตอบที่ดีที่สุด ดังนั้น &amp;lt;math&amp;gt; k \leq m \,&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;จะใช้เทคนิค greedy algorithm นำหน้าเสมอ ดังนี้ ให้ &amp;lt;math&amp;gt; G=\{i_1,i_2,...,i_k \} \, &amp;lt;/math&amp;gt; เป็นเซตของผู้ตรวจงานที่ได้จาก greedy algorithm ข้างต้น และ &amp;lt;math&amp;gt; OPT=\{j_1,j_2,...,j_m \} \, &amp;lt;/math&amp;gt; เป็นเซตของผู้ตรวจงานที่ได้จาก optimal algorithm (อัลกอริทึมสำหรับการแก้ปัญหาข้างต้นที่ให้เซตของผู้ตรวจงานที่มีขนาดน้อยที่สุด) เราจะทำการพิสูจน์โดยบอกว่า &amp;lt;math&amp;gt; k = m \,&amp;lt;/math&amp;gt; สังเกตว่า เนื่องจาก &amp;lt;math&amp;gt; OPT \, &amp;lt;/math&amp;gt; เป็นคำตอบที่ดีที่สุด ดังนั้น &amp;lt;math&amp;gt; k \leq m \,&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;สมมติให้เวลาการเข้างานของ &amp;lt;math&amp;gt; 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;lt;math&amp;gt; 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;#039;&amp;#039;&amp;#039;lemma:&amp;#039;&amp;#039;&amp;#039;สำหรับ &amp;lt;math&amp;gt; r \leq k \,&amp;lt;/math&amp;gt; ใด ๆ แล้ว &amp;lt;math&amp;gt; f(i_r) \geq f(j_r) \,&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;#039;&amp;#039;&amp;#039;lemma:&amp;#039;&amp;#039;&amp;#039;สำหรับ &amp;lt;math&amp;gt; r \leq k \,&amp;lt;/math&amp;gt; ใด ๆ แล้ว &amp;lt;math&amp;gt; f(i_r) \geq f(j_r) \,&amp;lt;/math&amp;gt; เสมอ&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Aoy</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_7&amp;diff=7556&amp;oldid=prev</id>
		<title>Aoy: /* การพิสูจน์ความถูกต้องของอัลกอริทึม */</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_7&amp;diff=7556&amp;oldid=prev"/>
		<updated>2009-09-21T13:02:17Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;การพิสูจน์ความถูกต้องของอัลกอริทึม&lt;/span&gt;&lt;/span&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;รุ่นแก้ไขเมื่อ 13:02, 21 กันยายน 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;/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;#039;&amp;#039;การพิสูจน์ความถูกต้องของอัลกอริทึม&amp;#039;&amp;#039;==&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;#039;&amp;#039;การพิสูจน์ความถูกต้องของอัลกอริทึม&amp;#039;&amp;#039;==&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;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; G=\{i_1,i_2,...,i_k \} \, &amp;lt;/math&amp;gt; เป็นเซตของผู้ตรวจงานที่ได้จาก greedy algorithm ข้างต้น และ &amp;lt;math&amp;gt; OPT=\{j_1,j_2,...,j_m \} \, &amp;lt;/math&amp;gt; เป็นเซตของผู้ตรวจงานที่ได้จาก optimal algorithm (อัลกอริทึมสำหรับการแก้ปัญหาข้างต้นที่ให้เซตของผู้ตรวจงานที่มีขนาดน้อยที่สุด) เราจะทำการพิสูจน์โดยบอกว่า &amp;lt;math&amp;gt; k = m \,&amp;lt;/math&amp;gt; สมมติให้เวลาการเข้างานของ &amp;lt;math&amp;gt; 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; G=\{i_1,i_2,...,i_k \} \, &amp;lt;/math&amp;gt; เป็นเซตของผู้ตรวจงานที่ได้จาก greedy algorithm ข้างต้น และ &amp;lt;math&amp;gt; OPT=\{j_1,j_2,...,j_m \} \, &amp;lt;/math&amp;gt; เป็นเซตของผู้ตรวจงานที่ได้จาก optimal algorithm (อัลกอริทึมสำหรับการแก้ปัญหาข้างต้นที่ให้เซตของผู้ตรวจงานที่มีขนาดน้อยที่สุด) เราจะทำการพิสูจน์โดยบอกว่า &amp;lt;math&amp;gt; k = m \,&amp;lt;/math&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;สังเกตว่า เนื่องจาก &amp;lt;math&amp;gt; OPT \, &amp;lt;/math&amp;gt; เป็นคำตอบที่ดีที่สุด ดังนั้น &amp;lt;math&amp;gt; k \leq m \,&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; &lt;/ins&gt;สมมติให้เวลาการเข้างานของ &amp;lt;math&amp;gt; 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;#039;&amp;#039;&amp;#039;lemma:&amp;#039;&amp;#039;&amp;#039;สำหรับ &amp;lt;math&amp;gt; r \leq k \,&amp;lt;/math&amp;gt; ใด ๆ แล้ว &amp;lt;math&amp;gt; f(i_r) \geq f(j_r) \,&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;#039;&amp;#039;&amp;#039;lemma:&amp;#039;&amp;#039;&amp;#039;สำหรับ &amp;lt;math&amp;gt; r \leq k \,&amp;lt;/math&amp;gt; ใด ๆ แล้ว &amp;lt;math&amp;gt; f(i_r) \geq f(j_r) \,&amp;lt;/math&amp;gt; เสมอ&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-l30&quot; &gt;แถว 30:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;แถว 32:&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; f(i_r) &amp;lt; f(j_r) \,&amp;lt;/math&amp;gt; พิจารณาการที่ greedy algorithm เลือกผู้ตรวจงานถึงคนที่ &amp;lt;math&amp;gt; i_{r-1} \, &amp;lt;/math&amp;gt; แสดงว่าต้องมีคนงานคนหนึ่งให้เป็นคนที่ &amp;lt;math&amp;gt; k \, &amp;lt;/math&amp;gt; ที่มีเวลาเริ่มงานทีหลังผู้ตรวจงานคนที่ &amp;lt;math&amp;gt; i_{r-1} \, &amp;lt;/math&amp;gt; นี้ นั่นคือ &amp;lt;math&amp;gt; s_k &amp;gt; f(i_{r-1}) \,&amp;lt;/math&amp;gt; เราจะได้ว่าเวลาการทำงานของคนงานคนที่ &amp;lt;math&amp;gt; k \,&amp;lt;/math&amp;gt; นี้จะต้อง overlap กับผู้ตรวจงานคนที่ &amp;lt;math&amp;gt; j_r \, &amp;lt;/math&amp;gt; ของ &amp;lt;math&amp;gt; OPT \, &amp;lt;/math&amp;gt; ด้วย เพราะไม่เช่นนั้นคนที่ &amp;lt;math&amp;gt; k \, &amp;lt;/math&amp;gt; นี้ก็จะไม่มีผู้ตรวจงานคนไหน ตรวจงานเค้าได้ (ไม่เป็นไปตามเงื่อนไขของบริษัท) แต่เนื่องจาก greedy algorithm เลือกผู้ตรวจงานเป็นคนงานคนที่มีเวลาเลิกงานช้าที่สุด และในที่นี้ greedy algorithm เลือกคนที่ &amp;lt;math&amp;gt; i_r \,&amp;lt;/math&amp;gt; จึงเกิดข้อขัดแย้งที่ว่า &amp;lt;math&amp;gt; f(i_r) &amp;lt; f(j_r) \,&amp;lt;/math&amp;gt; ดังนั้นเราสามารถสรุปได้ว่า &amp;lt;math&amp;gt; f(i_r) \geq f(j_r) \,&amp;lt;/math&amp;gt; สำหรับ &amp;lt;math&amp;gt; r \leq k \,&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; f(i_r) &amp;lt; f(j_r) \,&amp;lt;/math&amp;gt; พิจารณาการที่ greedy algorithm เลือกผู้ตรวจงานถึงคนที่ &amp;lt;math&amp;gt; i_{r-1} \, &amp;lt;/math&amp;gt; แสดงว่าต้องมีคนงานคนหนึ่งให้เป็นคนที่ &amp;lt;math&amp;gt; k \, &amp;lt;/math&amp;gt; ที่มีเวลาเริ่มงานทีหลังผู้ตรวจงานคนที่ &amp;lt;math&amp;gt; i_{r-1} \, &amp;lt;/math&amp;gt; นี้ นั่นคือ &amp;lt;math&amp;gt; s_k &amp;gt; f(i_{r-1}) \,&amp;lt;/math&amp;gt; เราจะได้ว่าเวลาการทำงานของคนงานคนที่ &amp;lt;math&amp;gt; k \,&amp;lt;/math&amp;gt; นี้จะต้อง overlap กับผู้ตรวจงานคนที่ &amp;lt;math&amp;gt; j_r \, &amp;lt;/math&amp;gt; ของ &amp;lt;math&amp;gt; OPT \, &amp;lt;/math&amp;gt; ด้วย เพราะไม่เช่นนั้นคนที่ &amp;lt;math&amp;gt; k \, &amp;lt;/math&amp;gt; นี้ก็จะไม่มีผู้ตรวจงานคนไหน ตรวจงานเค้าได้ (ไม่เป็นไปตามเงื่อนไขของบริษัท) แต่เนื่องจาก greedy algorithm เลือกผู้ตรวจงานเป็นคนงานคนที่มีเวลาเลิกงานช้าที่สุด และในที่นี้ greedy algorithm เลือกคนที่ &amp;lt;math&amp;gt; i_r \,&amp;lt;/math&amp;gt; จึงเกิดข้อขัดแย้งที่ว่า &amp;lt;math&amp;gt; f(i_r) &amp;lt; f(j_r) \,&amp;lt;/math&amp;gt; ดังนั้นเราสามารถสรุปได้ว่า &amp;lt;math&amp;gt; f(i_r) \geq f(j_r) \,&amp;lt;/math&amp;gt; สำหรับ &amp;lt;math&amp;gt; r \leq k \,&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;&amp;#039;&amp;#039;&amp;#039;ทฤษฎีบท:&amp;#039;&amp;#039;&amp;#039; Greedy algorithm ใช้จำนวนผู้ตรวจงานน้อยที่สุดเท่าที่จะเป็นไปได้ กล่าวคือ &amp;lt;math&amp;gt;  k = m \,&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;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;#039;&amp;#039;&amp;#039;พิสูจน์:&amp;#039;&amp;#039;&amp;#039; สมมติเพื่อให้เกิดข้อขัดแย้งว่า &amp;lt;math&amp;gt; m &amp;lt; k \,&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;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; OPT \, &amp;lt;/math&amp;gt; เพิ่มคนงานคนที่ &amp;lt;math&amp;gt; j_m \, &amp;lt;/math&amp;gt; เข้าไปเป็นผู้ตรวจงาน เนื่องจากผู้ตรวจงาน &amp;lt;math&amp;gt; j_1,j_2,...,j_m \, &amp;lt;/math&amp;gt; ตรวจงานคนงานได้ครบทุกคนตามเงื่อนไขของบริษัทแล้ว แสดงว่าไม่มีคนงานคนไหนที่มีเวลาทำงานไม่ overlap กับผู้ตรวจงาน &amp;lt;math&amp;gt; m \, &amp;lt;/math&amp;gt; ในวิธีการของ &amp;lt;math&amp;gt; OPT \,&amp;lt;/math&amp;gt; และจาก lemma เราได้ว่า &amp;lt;math&amp;gt; f(i_r) \geq f(j_r) \,&amp;lt;/math&amp;gt; จึงได้ว่าไม่มีคนงานคนไหนที่ที่มีเวลาทำงานไม่ overlap กับผู้ตรวจงานคนที่ &amp;lt;math&amp;gt; i_m \,&amp;lt;/math&amp;gt; ด้วย แต่การที่ greedy algorithm ยังเพิ่มผู้ตรวจงานคนที่ &amp;lt;math&amp;gt; i_{m+1} \,&amp;lt;/math&amp;gt; เข้าไปอีก แสดงว่า greedy algorithm ยังทำงานไม่จบ ทั้ง ๆ ที่ควรจบได้แล้ว เพราะคนงานทุกคนมีผู้ตรวจงานที่มีเวลา overlap กับตนเองแล้ว จึงเกิดข้อขัดแย้ง &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;พิจารณาเวลาที่ greedy algorithm เพิ่งจะปักเสาต้นที่ &amp;lt;math&amp;gt;k \,&amp;lt;/math&amp;gt; ไป เราพบว่าบ้านทุกบ้านจะต้องถูกครอบคลุมด้วยเสา &amp;lt;math&amp;gt;\ell \,&amp;lt;/math&amp;gt; ต้นที่ปักไปแล้วตามการให้เหตุผลข้างต้น แต่การที่ &amp;lt;math&amp;gt;k &amp;gt; \ell \,&amp;lt;/math&amp;gt; แสดงว่า greedy algorithm ยังทำงานต่อไปทั้งทที่มันควรจะหยุดการทำงานตั้งแต่ตอนที่ปักเสาต้นที่ &amp;lt;math&amp;gt;\ell \,&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;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; k = m \,&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>Aoy</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_7&amp;diff=7555&amp;oldid=prev</id>
		<title>Aoy: /* การพิสูจน์ความถูกต้องของอัลกอริทึม */</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_7&amp;diff=7555&amp;oldid=prev"/>
		<updated>2009-09-21T12:48:26Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;การพิสูจน์ความถูกต้องของอัลกอริทึม&lt;/span&gt;&lt;/span&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;รุ่นแก้ไขเมื่อ 12:48, 21 กันยายน 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-l27&quot; &gt;แถว 27:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;แถว 27:&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;#039;&amp;#039;&amp;#039;พิสูจน์:&amp;#039;&amp;#039;&amp;#039;ทำการพิสูจน์โดย induction บน r กรณี base case &amp;lt;math&amp;gt; r=1 \, &amp;lt;/math&amp;gt; เนื่องจาก greedy algorithm เลือกคนงานที่มีเวลาเลิกงานช้าที่สุดที่ overlap กับคนงานที่มีเวลาเลิกงานน้อยที่สุดที่กำลังพิจารณาในเซต &amp;lt;math&amp;gt; S \, &amp;lt;/math&amp;gt; เป็นผู้ตรวจงาน ดังนั้น &amp;lt;math&amp;gt; f(i_1) \geq f(j_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;#039;&amp;#039;&amp;#039;พิสูจน์:&amp;#039;&amp;#039;&amp;#039;ทำการพิสูจน์โดย induction บน r กรณี base case &amp;lt;math&amp;gt; r=1 \, &amp;lt;/math&amp;gt; เนื่องจาก greedy algorithm เลือกคนงานที่มีเวลาเลิกงานช้าที่สุดที่ overlap กับคนงานที่มีเวลาเลิกงานน้อยที่สุดที่กำลังพิจารณาในเซต &amp;lt;math&amp;gt; S \, &amp;lt;/math&amp;gt; เป็นผู้ตรวจงาน ดังนั้น &amp;lt;math&amp;gt; f(i_1) \geq f(j_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;lt;math&amp;gt; r &amp;gt; 1 \, &amp;lt;/math&amp;gt; สมมติให้ข้อความที่ต้องการพิสูจน์เป็นจริงสำหรับค่า &amp;lt;math&amp;gt; r-1 \, &amp;lt;/math&amp;gt; นั่นคือ &amp;lt;math&amp;gt; f(i_{r-1}) \geq f(j_{r-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;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; r &amp;gt; 1 \, &amp;lt;/math&amp;gt; สมมติให้ข้อความที่ต้องการพิสูจน์เป็นจริงสำหรับค่า &amp;lt;math&amp;gt; r-1 \, &amp;lt;/math&amp;gt; นั่นคือ &amp;lt;math&amp;gt; f(i_{r-1}) \geq f(j_{r-1}) \, &amp;lt;/math&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;ต้องการพิสูจน์ว่า สำหรับค่า &amp;lt;math&amp;gt; f(i_r) \geq f(j_r) \, &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; f(i_r) &amp;lt; f(j_r) \,&amp;lt;/math&amp;gt; พิจารณาการที่ greedy algorithm เลือกผู้ตรวจงานถึงคนที่ &amp;lt;math&amp;gt; i_{r-1} \, &amp;lt;/math&amp;gt; แสดงว่าต้องมีคนงานคนหนึ่งให้เป็นคนที่ &amp;lt;math&amp;gt; k \, &amp;lt;/math&amp;gt; ที่มีเวลาเริ่มงานทีหลังผู้ตรวจงานคนที่ &amp;lt;math&amp;gt; i_{r-1} \, &amp;lt;/math&amp;gt; นี้ นั่นคือ &amp;lt;math&amp;gt; s_k &amp;gt; f(i_{r-1}) \,&amp;lt;/math&amp;gt; เราจะได้ว่าเวลาการทำงานของคนงานคนที่ &amp;lt;math&amp;gt; k \,&amp;lt;/math&amp;gt; นี้จะต้อง overlap กับผู้ตรวจงานคนที่ &amp;lt;math&amp;gt; j_r \, &amp;lt;/math&amp;gt; ของ &amp;lt;math&amp;gt; OPT \, &amp;lt;/math&amp;gt; ด้วย เพราะไม่เช่นนั้นคนที่ &amp;lt;math&amp;gt; k \, &amp;lt;/math&amp;gt; นี้ก็จะไม่มีผู้ตรวจงานคนไหน ตรวจงานเค้าได้ (ไม่เป็นไปตามเงื่อนไขของบริษัท) แต่เนื่องจาก greedy algorithm เลือกผู้ตรวจงานเป็นคนงานคนที่มีเวลาเลิกงานช้าที่สุด และในที่นี้ greedy algorithm เลือกคนที่ &amp;lt;math&amp;gt; i_r \,&amp;lt;/math&amp;gt; จึงเกิดข้อขัดแย้งที่ว่า &amp;lt;math&amp;gt; f(i_r) &amp;lt; f(j_r) \,&amp;lt;/math&amp;gt; ดังนั้นเราสามารถสรุปได้ว่า &amp;lt;math&amp;gt; f(i_r) \geq f(j_r) \,&amp;lt;/math&amp;gt; สำหรับ &amp;lt;math&amp;gt; r \leq k \,&amp;lt;/math&amp;gt; ใด ๆ&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Aoy</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_7&amp;diff=7547&amp;oldid=prev</id>
		<title>Aoy: /* การพิสูจน์ความถูกต้องของอัลกอริทึม */</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_7&amp;diff=7547&amp;oldid=prev"/>
		<updated>2009-09-19T08:23:42Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;การพิสูจน์ความถูกต้องของอัลกอริทึม&lt;/span&gt;&lt;/span&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;รุ่นแก้ไขเมื่อ 08:23, 19 กันยายน 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-l23&quot; &gt;แถว 23:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;แถว 23:&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;จะใช้เทคนิค greedy algorithm นำหน้าเสมอ ดังนี้ ให้ &amp;lt;math&amp;gt; G=\{i_1,i_2,...,i_k \} \, &amp;lt;/math&amp;gt; เป็นเซตของผู้ตรวจงานที่ได้จาก greedy algorithm ข้างต้น และ &amp;lt;math&amp;gt; OPT=\{j_1,j_2,...,j_m \} \, &amp;lt;/math&amp;gt; เป็นเซตของผู้ตรวจงานที่ได้จาก optimal algorithm (อัลกอริทึมสำหรับการแก้ปัญหาข้างต้นที่ให้เซตของผู้ตรวจงานที่มีขนาดน้อยที่สุด) เราจะทำการพิสูจน์โดยบอกว่า &amp;lt;math&amp;gt; k = m \,&amp;lt;/math&amp;gt; สมมติให้เวลาการเข้างานของ &amp;lt;math&amp;gt; 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;จะใช้เทคนิค greedy algorithm นำหน้าเสมอ ดังนี้ ให้ &amp;lt;math&amp;gt; G=\{i_1,i_2,...,i_k \} \, &amp;lt;/math&amp;gt; เป็นเซตของผู้ตรวจงานที่ได้จาก greedy algorithm ข้างต้น และ &amp;lt;math&amp;gt; OPT=\{j_1,j_2,...,j_m \} \, &amp;lt;/math&amp;gt; เป็นเซตของผู้ตรวจงานที่ได้จาก optimal algorithm (อัลกอริทึมสำหรับการแก้ปัญหาข้างต้นที่ให้เซตของผู้ตรวจงานที่มีขนาดน้อยที่สุด) เราจะทำการพิสูจน์โดยบอกว่า &amp;lt;math&amp;gt; k = m \,&amp;lt;/math&amp;gt; สมมติให้เวลาการเข้างานของ &amp;lt;math&amp;gt; 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;#039;&amp;#039;lemma:&amp;#039;&amp;#039;สำหรับ &amp;lt;math&amp;gt; r \leq k \,&amp;lt;/math&amp;gt; ใด ๆ แล้ว &amp;lt;math&amp;gt; f(i_r) \geq f(j_r) \,&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;#039;&lt;/ins&gt;&amp;#039;&amp;#039;lemma:&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;#039;&lt;/ins&gt;&amp;#039;&amp;#039;สำหรับ &amp;lt;math&amp;gt; r \leq k \,&amp;lt;/math&amp;gt; ใด ๆ แล้ว &amp;lt;math&amp;gt; f(i_r) \geq f(j_r) \,&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;&amp;#039;ทำการพิสูจน์โดย induction บน r กรณี base case &amp;lt;math&amp;gt; r=1 \, &amp;lt;/math&amp;gt; เนื่องจาก greedy algorithm เลือกคนงานที่มีเวลาเลิกงานช้าที่สุดที่ overlap กับคนงานที่มีเวลาเลิกงานน้อยที่สุดที่กำลังพิจารณาในเซต &amp;lt;math&amp;gt; S \, &amp;lt;/math&amp;gt; เป็นผู้ตรวจงาน ดังนั้น &amp;lt;math&amp;gt; f(i_1) \geq f(j_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;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;&lt;/ins&gt;&amp;#039;&amp;#039;พิสูจน์&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;:&amp;#039;&lt;/ins&gt;&amp;#039;&amp;#039;ทำการพิสูจน์โดย induction บน r กรณี base case &amp;lt;math&amp;gt; r=1 \, &amp;lt;/math&amp;gt; เนื่องจาก greedy algorithm เลือกคนงานที่มีเวลาเลิกงานช้าที่สุดที่ overlap กับคนงานที่มีเวลาเลิกงานน้อยที่สุดที่กำลังพิจารณาในเซต &amp;lt;math&amp;gt; S \, &amp;lt;/math&amp;gt; เป็นผู้ตรวจงาน ดังนั้น &amp;lt;math&amp;gt; f(i_1) \geq f(j_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;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; r &amp;gt; 1 \, &amp;lt;/math&amp;gt; สมมติให้ข้อความที่ต้องการพิสูจน์เป็นจริงสำหรับค่า &amp;lt;math&amp;gt; r-1 \, &amp;lt;/math&amp;gt; นั่นคือ &amp;lt;math&amp;gt; f(i_{r-1}) \geq f(j_{r-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; r &amp;gt; 1 \, &amp;lt;/math&amp;gt; สมมติให้ข้อความที่ต้องการพิสูจน์เป็นจริงสำหรับค่า &amp;lt;math&amp;gt; r-1 \, &amp;lt;/math&amp;gt; นั่นคือ &amp;lt;math&amp;gt; f(i_{r-1}) \geq f(j_{r-1}) \, &amp;lt;/math&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Aoy</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_7&amp;diff=7546&amp;oldid=prev</id>
		<title>Aoy เมื่อ 08:21, 19 กันยายน 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_7&amp;diff=7546&amp;oldid=prev"/>
		<updated>2009-09-19T08:21:34Z</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;รุ่นแก้ไขเมื่อ 08:21, 19 กันยายน 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-l19&quot; &gt;แถว 19:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;แถว 19:&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;}&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;}&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;div&gt;&amp;lt;/geshi&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;/geshi&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;==&amp;#039;&amp;#039;การพิสูจน์ความถูกต้องของอัลกอริทึม&amp;#039;&amp;#039;==&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 นำหน้าเสมอ ดังนี้ ให้ &amp;lt;math&amp;gt; G=\{i_1,i_2,...,i_k \} \, &amp;lt;/math&amp;gt; เป็นเซตของผู้ตรวจงานที่ได้จาก greedy algorithm ข้างต้น และ &amp;lt;math&amp;gt; OPT=\{j_1,j_2,...,j_m \} \, &amp;lt;/math&amp;gt; เป็นเซตของผู้ตรวจงานที่ได้จาก optimal algorithm (อัลกอริทึมสำหรับการแก้ปัญหาข้างต้นที่ให้เซตของผู้ตรวจงานที่มีขนาดน้อยที่สุด) เราจะทำการพิสูจน์โดยบอกว่า &amp;lt;math&amp;gt; k = m \,&amp;lt;/math&amp;gt; สมมติให้เวลาการเข้างานของ &amp;lt;math&amp;gt; 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;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;#039;&amp;#039;lemma:&amp;#039;&amp;#039;สำหรับ &amp;lt;math&amp;gt; r \leq k \,&amp;lt;/math&amp;gt; ใด ๆ แล้ว &amp;lt;math&amp;gt; f(i_r) \geq f(j_r) \,&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;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;#039;&amp;#039;พิสูจน์&amp;#039;&amp;#039;ทำการพิสูจน์โดย induction บน r กรณี base case &amp;lt;math&amp;gt; r=1 \, &amp;lt;/math&amp;gt; เนื่องจาก greedy algorithm เลือกคนงานที่มีเวลาเลิกงานช้าที่สุดที่ overlap กับคนงานที่มีเวลาเลิกงานน้อยที่สุดที่กำลังพิจารณาในเซต &amp;lt;math&amp;gt; S \, &amp;lt;/math&amp;gt; เป็นผู้ตรวจงาน ดังนั้น &amp;lt;math&amp;gt; f(i_1) \geq f(j_1) \, &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;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; r &amp;gt; 1 \, &amp;lt;/math&amp;gt; สมมติให้ข้อความที่ต้องการพิสูจน์เป็นจริงสำหรับค่า &amp;lt;math&amp;gt; r-1 \, &amp;lt;/math&amp;gt; นั่นคือ &amp;lt;math&amp;gt; f(i_{r-1}) \geq f(j_{r-1}) \, &amp;lt;/math&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Aoy</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_7&amp;diff=7545&amp;oldid=prev</id>
		<title>Aoy: /* อัลกอริทึม */</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_7&amp;diff=7545&amp;oldid=prev"/>
		<updated>2009-09-19T08:12:50Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;อัลกอริทึม&lt;/span&gt;&lt;/span&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;รุ่นแก้ไขเมื่อ 08:12, 19 กันยายน 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-l13&quot; &gt;แถว 13:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;แถว 13:&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;      l = {m in S| min f(m)} // ให้ l เป็นคนงานที่มีเวลาทำงาน overlap กับ คนงานคนที่ 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;      l = {m in S| min f(m)} // ให้ l เป็นคนงานที่มีเวลาทำงาน overlap กับ คนงานคนที่ 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;div&gt;           G = G union l // เพิ่มคนงาน l เข้าไปในเซตของผู้ตรวจงาน&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;           G = G union l // เพิ่มคนงาน l เข้าไปในเซตของผู้ตรวจงาน&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;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;Ol = {k in S| s(k) &amp;lt;= f(l) or s(l) &amp;lt;= f(k)} // Ol เป็นเซตของคนงานทุกคนในเซตของคนงานที่กำลังพิจารณาที่มีเวลาทำงาน overlap กับผู้ตรวจงาน l&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;          &lt;/ins&gt;Ol = {k in S| s(k) &amp;lt;= f(l) or s(l) &amp;lt;= f(k)} // Ol เป็นเซตของคนงานทุกคนในเซตของคนงานที่กำลังพิจารณาที่มีเวลาทำงาน overlap กับผู้ตรวจงาน l&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;div&gt;      S= S - Ol&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= S - Ol&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;div&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;     }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Aoy</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_7&amp;diff=7544&amp;oldid=prev</id>
		<title>Aoy: /* อัลกอริทึม */</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_7&amp;diff=7544&amp;oldid=prev"/>
		<updated>2009-09-19T08:12:39Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;อัลกอริทึม&lt;/span&gt;&lt;/span&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;รุ่นแก้ไขเมื่อ 08:12, 19 กันยายน 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;==&amp;#039;&amp;#039;อัลกอริทึม&amp;#039;&amp;#039;==&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;#039;&amp;#039;อัลกอริทึม&amp;#039;&amp;#039;==&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;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;แล้วเลือกคนที่มีเวลาทำงาน overlap กับคนงานนี้ที่มีเวลาเลิกงานช้าที่สุดเป็นผู้ตรวจงาน จากนั้นลบคนงานทุก ๆ คนที่มีเวลาทำงาน overlap กับผู้ตรวจงานคนนี้ออกจากเซตของคนงานที่กำลังพิจารณา ทำแบบนี้ไปเรื่อย ๆ จนเซตของคนงานที่กำลังพิจารณาเป็นเซตว่าง&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;เมื่อพิจารณาเวลาการทำงานของคนงานที่มีเวลาเลิกงานช้าที่สุด &lt;/ins&gt;แล้วเลือกคนที่มีเวลาทำงาน overlap กับคนงานนี้ที่มีเวลาเลิกงานช้าที่สุดเป็นผู้ตรวจงาน จากนั้นลบคนงานทุก ๆ คนที่มีเวลาทำงาน overlap กับผู้ตรวจงานคนนี้ออกจากเซตของคนงานที่กำลังพิจารณา ทำแบบนี้ไปเรื่อย ๆ จนเซตของคนงานที่กำลังพิจารณาเป็นเซตว่าง&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;geshi lang=&amp;quot;c&amp;quot;&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;geshi lang=&amp;quot;c&amp;quot;&amp;gt;&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-l6&quot; &gt;แถว 6:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;แถว 6:&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;{&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;{&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;div&gt;     G = empty set // ให้ G เป็นเซตของผู้ตรวจงาน&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;     G = empty set // ให้ G เป็นเซตของผู้ตรวจงาน&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;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;S = {1,2,...,n} // เซตของคนงานที่กำลังพิจารณา ที่เรียงตามเวลาเลิกงานจากน้อยไปมาก นั่นคือ f1 &amp;lt;= f2 &amp;lt;= ... &amp;lt;= fn นั่นเอง&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;        &lt;/ins&gt;S = {1,2,...,n} // เซตของคนงานที่กำลังพิจารณา ที่เรียงตามเวลาเลิกงานจากน้อยไปมาก นั่นคือ f1 &amp;lt;= f2 &amp;lt;= ... &amp;lt;= fn นั่นเอง&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;div&gt;         while S not empty do&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;         while S not empty do&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;div&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;     {&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;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;      i = {j in S| &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;min_j &lt;/del&gt;f(j)}&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;      i = {j in S| &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;min &lt;/ins&gt;f(j)} &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;// i เป็นคนงานในเซตของคนงานที่กำลังพิจารณาที่มีเวลาเลิกงานช้าที่สุดตอนนี้&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;          Oi={k in S| s(k) &amp;lt;= f(i) or s(i) &amp;lt; = f(k)} // Oi เป็นเซตของคนงานทุกคนในเซตของคนงานที่กำลังพิจารณาที่มีเวลาทำงาน overlap กับคนที่ i&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;     l = {m in S| min f(m)} // ให้ l เป็นคนงานที่มีเวลาทำงาน overlap กับ คนงานคนที่ i ที่เลิกงานช้าที่สุด&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;          G = G union l // เพิ่มคนงาน l เข้าไปในเซตของผู้ตรวจงาน&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;     Ol = {k in S| s(k) &amp;lt;= f(l) or s(l) &amp;lt;= f(k)} // Ol เป็นเซตของคนงานทุกคนในเซตของคนงานที่กำลังพิจารณาที่มีเวลาทำงาน overlap กับผู้ตรวจงาน l&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;     S= S - Ol&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;div&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;     }&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;     return G&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;div&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;}&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;div&gt;&amp;lt;/geshi&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;/geshi&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Aoy</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_7&amp;diff=7543&amp;oldid=prev</id>
		<title>Aoy: หน้าที่ถูกสร้างด้วย &#039;==&#039;&#039;อัลกอริทึม&#039;&#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_7&amp;diff=7543&amp;oldid=prev"/>
		<updated>2009-09-19T08:07:08Z</updated>

		<summary type="html">&lt;p&gt;หน้าที่ถูกสร้างด้วย &amp;#039;==&amp;#039;&amp;#039;อัลกอริทึม&amp;#039;&amp;#039;== เรียงเวลาการเข้างานของคนงานตามเวล…&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;หน้าใหม่&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==&amp;#039;&amp;#039;อัลกอริทึม&amp;#039;&amp;#039;==&lt;br /&gt;
เรียงเวลาการเข้างานของคนงานตามเวลาเลิกจากน้อยไปหามาก เมื่อพิจารณาเวลาการทำงานของคนงานที่มีเวลาเลิกงานน้อยที่สุด แล้วเลือกคนที่มีเวลาทำงาน overlap กับคนงานนี้ที่มีเวลาเลิกงานช้าที่สุดเป็นผู้ตรวจงาน จากนั้นลบคนงานทุก ๆ คนที่มีเวลาทำงาน overlap กับผู้ตรวจงานคนนี้ออกจากเซตของคนงานที่กำลังพิจารณา ทำแบบนี้ไปเรื่อย ๆ จนเซตของคนงานที่กำลังพิจารณาเป็นเซตว่าง&lt;br /&gt;
&lt;br /&gt;
&amp;lt;geshi lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Supervisor()&lt;br /&gt;
{&lt;br /&gt;
    G = empty set // ให้ G เป็นเซตของผู้ตรวจงาน&lt;br /&gt;
    S = {1,2,...,n} // เซตของคนงานที่กำลังพิจารณา ที่เรียงตามเวลาเลิกงานจากน้อยไปมาก นั่นคือ f1 &amp;lt;= f2 &amp;lt;= ... &amp;lt;= fn นั่นเอง&lt;br /&gt;
        while S not empty do&lt;br /&gt;
    {&lt;br /&gt;
     i = {j in S| min_j f(j)}&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/geshi&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aoy</name></author>
		
	</entry>
</feed>