Greedy อัลกอริทึม



 การทำงานของอัลกอริทึม Greedy  อัลกอริทึม ต้องการเขียนพร้อม เพื่อสร้างรูปเรื่องนี้ 

1. รูปเปรียบเทียบการเลือกเส้นทาง (Shortest Path)

เป็นรูปที่ตัวละครยืนอยู่ตรงทางแยก แล้วเลือกทางที่สั้นที่สุดทันที แม้ว่าปลายทางของเส้นนั้นอาจจะอ้อมก็ตาม

Prompt: A 3D isometric infographic showing a character at a crossroad in a digital forest. The character chooses the shortest immediate path labeled "5km" instead of a longer "10km" path, but the "10km" path leads to a straight line while the "5km" leads to a complex zigzag. Minimalist tech style, vibrant colors.

2. รูปต้นไม้การตัดสินใจ (Decision Tree)

แสดงให้เห็นว่าในแต่ละชั้น (Level) อัลกอริทึมจะเลือกโหนดที่มีค่าสูงสุดเสมอ

Prompt: A glowing digital tree diagram where each branch has numbers. A bright highlight path follows only the highest numbers at each level from top to bottom. Vector art, clean lines, dark background with neon blue accents.

3. รูปเปรียบเทียบ Greedy vs Optimal (The Maze/Mountain)

รูปที่คนปีนเขาโดยเลือกทางที่ชันที่สุดเพื่อขึ้นที่สูงให้เร็วที่สุด (Greedy) เทียบกับทางที่อ้อมแต่ไปถึงยอดเขาที่สูงกว่า


ความคิดเห็น