Submit Search
Upload
Thitma
•
0 likes
•
35 views
O
OomBorwonpirom
Follow
บทที่ 13-14 นางสาว ธิติมา ผาสุข 600106886 นางสาว ศิรินยา สายรอดแดง 60011280
Read less
Read more
Technology
Report
Share
Report
Share
1 of 27
Download now
Download to read offline
Recommended
Jameball
Jameball
OomBorwonpirom
Ban61
Ban61
OomBorwonpirom
Chaiyporn01
Chaiyporn01
OomBorwonpirom
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
Recommended
Jameball
Jameball
OomBorwonpirom
Ban61
Ban61
OomBorwonpirom
Chaiyporn01
Chaiyporn01
OomBorwonpirom
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
Introduction to Data Science
Introduction to Data Science
Christy Abraham Joy
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
Vit Horky
The six step guide to practical project management
The six step guide to practical project management
MindGenius
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Applitools
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
GetSmarter
ChatGPT webinar slides
ChatGPT webinar slides
Alireza Esmikhani
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
Project for Public Spaces & National Center for Biking and Walking
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
DevGAMM Conference
More Related Content
Featured
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
Introduction to Data Science
Introduction to Data Science
Christy Abraham Joy
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
Vit Horky
The six step guide to practical project management
The six step guide to practical project management
MindGenius
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Applitools
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
GetSmarter
ChatGPT webinar slides
ChatGPT webinar slides
Alireza Esmikhani
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
Project for Public Spaces & National Center for Biking and Walking
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
DevGAMM Conference
Featured
(20)
Skeleton Culture Code
Skeleton Culture Code
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
How to have difficult conversations
How to have difficult conversations
Introduction to Data Science
Introduction to Data Science
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
The six step guide to practical project management
The six step guide to practical project management
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
ChatGPT webinar slides
ChatGPT webinar slides
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Thitma
1.
บทที่ 13 การแก้ปัญหาด้วยวิธีการเรียงลาดับข้อมูลชนิดอื่นๆ บทที่
14 การแก้ปัญหาด้วยอัลกอริทึมอื่นๆ จัดทาโดย นางสาว ศิรินยา รอดสายแดง 60011280 นางสาว ธิติมา ผาสุข 60016886 นาเสนอ อาจารย์ กฤษญกร พงษ์พรรฦก
2.
3.
SHELL SORT • การจัดเรียงแบบเชลล์
เป็นการจัดเรียงที่อาศัยเทคนิคการแบ่งข้อมูลออกเป็นกลุ่มย่อย หลายๆ กลุ่ม แล้วจัดเรียงข้อมูลในกลุ่มย่อยๆนั้น หลังจากนั้นก็ให้รวมกลุ่มย่อยๆ ให้ใหญ่ขึ้น เรื่อยๆ ขั้นสุดท้ายให้จัดเรียงข้อมูลทั้งหมดนั้นอีกครั้ง
4.
ตัวอย่าง กาหนด SEGMENT
เมื่อ K=3
5.
ขั้นตอนการทางาน • โดยทั่วไปการเลือกค่า K
ตัวแรกมักจะเลือกใช้ค่าเท่ากับครึ่งหนึ่งของข้อมูล เช่น ข้อมูลมี 10 ตัว K = N/2 = 10/2 = 5 • เรียงข้อมูลทุกตัวให้เสร็จสิ้น แล้วกาหนดค่า K ใหม่ (โดยทั่วไปจะเป็นครึ่งหนึ่งของค่า K ตัว แรก เช่น K1 = 5; K2 = 5/2 = 2) • ถ้า K > 1 ให้ทาซ้า จนกระทั่งเหลือข้อมูลกลุ่มเดียว ถ้า K = 1 ให้เรียงลาดับตามปกติ
6.
ตัวอย่างการทางานในละรอบของ K
7.
8.
การจัดเรียงข้อมูลโดยการรวม ข้อมูลเข้าด้วยกัน MERGE
SORT • การทา MERGE SORT ใช้หลักการ DIVIDE-AND-CONQUER เหมือนกับ QUICK SORT มีลักษณะของการแบ่งข้อมูลออกเป็นส่วนๆ แต่กระบวนการเรียงข้อมูลนั้นจะแตกต่าง ไปจาก QUICK SORT QUICK SORT กระทาการสลับข้อมูลไปพร้อมกับการแบ่งข้อมูล ออกเป็นส่วนๆ แต่ MERGE SORT นี้ กระทาการแบ่งข้อมูลออกเป็นส่วนๆก่อน แล้วค่อยเรียง ข้อมูลในส่วนย่อย จากนั้นนาเอาข้อมูลส่วนย่อยที่เรียงไว้แล้ว มารวมกันและเรียงไปในเวลา เดียวกัน อัลกอริทึมจะเรียงพร้อมกับผสานข้อมูล เข้าด้วยกันจนกระทั่งข้อมูลทุกตัวรวมกัน กลายเป็นข้อมูลเดียวอีกครั้ง
9.
ตัวอย่าง
10.
การจัดเรียงข้อมูลแบบเร็ว QUICK SORT •
การจัดเรียงแบบควิกซ์ ใช้หลักการ DIVIDE-AND-CONQUER อาศัยการจัดแบ่งข้อมูล ทั้งหมดออกเป็น 2 กลุ่ม โดยกลุ่มแรกจะเป็นกลุ่มของข้อมูลที่มีค่าน้อยกว่าค่ากลางที่กาหนด และส่วนที่สองเป็นกลุ่มของข้อมูลที่มีค่ามากกว่าค่ากลางที่กาหนด หลังจากนั้นแบ่งข้อมูลแต่ ละส่วนออกเป็น 2 ส่วนเช่นเดิม แบ่งไปเรื่อยๆจนไม่สามารถแบ่งได้ก็จะได้ข้อมูลที่เรียงกัน
11.
BUCKET SORT • สมมติว่าเรารู้ว่าขนาดของ
ARRAY ที่เราต้องจัดเรียงข้อมูลมีขนาดเล็ก และแน่นอน เรา อาจเลือกใช้ การจัดเรียงแบบกระจาย มาทาการจัดเรียงข้อมูลให้เราและ BUCKET SORT ก็ เป็นเทคนิควิธีอีก แบบหนึ่งที่ใช้การกระจายของข้อมูลมาเป็นตัวช่วยในการจัดเรียงลองดูภาพ ตัวอย่างของข้อมูลที่มีอยู่ใน ARRAY
12.
ตัวอย่าง
13.
การเรียงลาดับแบบฐานเป็นการเรียงลาดับ RADIX SORT การเรียงลาดับแบบฐานเป็นการเรียงลาดับโดยการพิจารณาข้อมูลทีละหลักใช้ข้อมูลกับ LINKED
LIST 1.เริ่มพิจารณาจากหลักที่มีค่าน้อยที่สุดก่อน นั่นคือถ้าข้อมูลเป็นเลขจานวนเต็มจะพิจารณาหลักหน่วยก่อน 2.การจัดเรียงจะนาข้อมูลทีละตัวแล้วนาไปเก็บไว้ที่ซึ่งจัดไว้สาหรับค่านั้น เป็นกลุ่มๆ ตามลาดับการเข้ามา 3.ในแต่ละรอบเมื่อจัดกลุ่มเรียบร้อยแล้วให้รวบรวมข้อมูลจากทุกกลุ่มเข้าด้วยกัน โดยเริ่มเรียงจากกลุ่มที่มีค่า น้อยทีสุดก่อนแล้วเรียงไปเรื่อยๆจนหมดทุกกลุ่ม 4.ในรอบต่อไปนาข้อมูลทั้งหมดที่ได้จัดเรียงในหลักหน่วยเรียบร้อยแล้วมาพิจารณาจัดเรียงในหลักสิบต่อไป ทาไปเรื่อยๆ จนกระทั่งครบทุกหลัก
14.
การจัดเรียงข้อมูลโดยใช้ฮีพ HEAP SORT •
ฮีปเป็นโครงสร้างข้อมูลที่มีลักษะการจัดเก็บข้อมูลแบบไบนารีทรี คือ แต่ละโหนดจะมีโหนด ลูกได้ไม่เกิน 2 โหนด และการจัดเก็บข้อมูลจะต้องจัดเก็บให้เต็มทีละชั้นเรียงจากโหนดด้าน ซ้ายมือไปด้านขวามือเสมอ ฮีปแบ่งเป็น 2 ประเภท คือ • MIN HEAP: ที่โหนดใดๆ ก็ตามภายในฮีป ข้อมูลที่ซับทรีจะต้องมีค่ามากกว่าหรือเท่ากับ ข้อมูลที่ตัวมันเสมอ(รูทโหนดมีค่าต่าที่สุด) • MAX HEAP : ที่โหนดใดๆ ก็ตามภายในฮีป ข้อมูลที่ซับทรีจะต้องมีค่าน้อยกว่าหรือเท่ากับ ข้อมูลที่ตัวมันเสมอ (รูทโหนดมีค่าสูงที่สุด)
15.
ตัวอย่าง
16.
17.
การเรียงลาดับข้อมูลภายนอก (EXTERNAL SORTING) •ใช้กับข้อมูลที่มีจานวนใหญ่เกินกว่าที่จะเก็บลงในหน่วยความจาได้หมดภายในครั้ง เดียว •จะใช้หน่วยความจาภายนอก
เช่น ดิสก์, เทป สาหรับเก็บข้อมูลบางส่วนที่ได้รับการ เรียงลาดับข้อมูลแล้ว แล้วจึงค่อยจัดการเรียงลาดับข้อมูลในส่วนต่อไป
18.
•ประเภทของการเรียงลาดับข้อมูล
19.
20.
DIVIDE AND CONQUER การแบ่งและเอาชนะ เป็นเทคนิคที่สาคัญและมีประสิทธิภาพ
ในการออกแบบอัลกอริทึม เป็นเทคนิคที่มีการการแบ่งปัญหาออกเป็นปัญหาย่อยๆ หลายปัญหา ทาให้การแก้ปัญหา ย่อยได้ง่าย ใช้กับการเรียงลาดับแบบผสาน และการค้นหาในต้นไม้ทวิภาคในการดาเนินการของ เทคนิค
21.
การแบ่งและเอาชนะ โดยใช้วิธีการเรียกซ้า(RECURSIVE) -
ใช้หลักการของการแบ่งและ เอาชนะซึ่งมีวิธีการทางาน • 1. แบ่ง : แบ่งสมาชิกที่ต้องการเรียงลาดับจานวน N ตัว เป็นส่วนย่อยโดยแต่ละส่วนมี สมาชิก N/2 ตัว • 2. เอาชนะ : เรียงลาดับสมาชิกในส่วนย่อยแบบเรียกซ้า โดยใช้วิธีการเรียงลาดับแบบผสาน • 3. นาส่วนย่อยที่มีการเรียงลาดับแล้วมารวมกันเพื่อผลิตข้อมูลที่เรียงลาดับ
22.
GREEDY ALGORITHM • อัลกอริทึมนี้มีหลักการอยู่ว่า
ในขณะใดๆก็ตาม เราจะหาคาตอบที่ดีที่สุดของ ปัญหา โดยการเลือกเอาคาตอบที่ดีที่สุด ในสถานะนั้นออกมาก่อน โปรดสังเกตว่า ปัญหาของการแลกเหรียญที่กล่าวมาข้างต้น จะใช้ได้ดีกับอัลกอริทึมนี้ เนื่องจาก คุณสมบัติพิเศษ ของเหรียญนั่นเอง ทีนี้ลองมาดูตัวอย่างใหม่ จะทาให้เห็นอะไรได้ ชัดเจนมากยิ่งขึ้น
23.
• สมมุติว่าเรามีเหรียญขนาดดังต่อไปนี้ เหรียญ 10
บาท, เหรียญ 5 บาท, และเหรียญ 1 บาท และสมมุติว่าเราต้องการแลกเงิน 15 บาท ถ้าเราใช้GREEDYALGORITHM เราจะได้เงินเหรียญดังนี้คือ เหรียญ 10 บาท จะได้1 เหรียญ เหรียญ 1 บาท จะได้5 เหรียญ รวมทั้งหมดแล้วจะได้เหรียญทั้งหมด5 เหรียญ จะเห็นได้ว่าคาตอบนี้ไม่ใช่คาตอบที่ดีที่สุดเนื่องจาก คาตอบที่แท้จริง *** ควรจะต้องได้เหรียญ 5 บาท ทั้งหมด 3 เหรียญเท่านั้น *** อย่างไรก็ตามขอย้าไว้อีกครั้งหนึ่งว่าวิธีการแบบ GREEDYALGORITHM นี้ไม่ได้ให้คาตอบที่ดีที่สุด ออกมา แต่สาหรับวิธีการนี้ก็ค่อนข้างจัดได้ว่าจะให้คาตอบที่จัดว่าดี ออกมาได้(ต้องพิจารณาแต่ละกรณี)
24.
DYNAMIC PROGRAMMING • เป็นเทคนิคการเขียนโปรแกรมที่ไม่ใช้RECURSIVECALL
เพื่อปรับปรุงประสิทธิภาพการทางานของ ขั้นตอนวิธีให้ดีขึ้น • โดยทั่วไปแล้วมีหลายกรณีที่การแก้ปัญหาโดยขั้นตอนวิธีแบบ RECURSIVEALGORITHM ให้ผลลัพธ์เร็ว กว่าวิธีการอื่นที่ไม่ใช้ RECURSIVECALL • ถ้าสงสัยว่าโปรแกรมแปลภาษา (COMPILER)อาจส่งผลให้โปรแกรมทางานอย่างไม่มีประสิทธิภาพ ก็ สามารถช่วย COMPILERได้โดยเขียนโปรแกรมแบบ NON-RECURSIVE • บันทึกผลลัพธ์ย่อยของแต่ละขั้นตอนอย่างเป็นระบบลงในตารางคือหลักการของ DYNAMIC PROGRAMMING
25.
BACKTRACKING ALGORITHM • เป็นเทคนิคที่ใช้ในการหาคาตอบให้กับปัญหาที่ต้องมีการทดสอบผลของการการตัดสินใจใน แต่ละขั้นตอนว่าจะดาเนินการต่อไปอย่างไร
ถ้าได้คาตอบที่ต้องการก็จะหยุดการทางาน แต่ถ้า ผลการตัดสินใจที่ผ่านมาไม่ได้คาตอบที่ต้องการก็จะมีการย้อนกลับขั้นตอนตามเส้นทางการ ตัดสิใจเดิมและตัดสินใจเดินหน้าค้นหาคาตอบต่อไปใหม่ • ตัวอย่างของการใช้เทคนิคนี้ในการออกแบบขั้นตอนวิธีเช่น การแก้ปัญหา 8 ราชินี (ปัญหา ยุทธศาสตร์ของเกมส์ ปัญหาการหาทางออกจากเขาวงกต
26.
STACK APPLICATIONS: BACKTRACKING
27.
จบการนาเสนอ
Download now