In the preceding chapters we have seen some elegant design principles—such as divide-andconquer, graph exploration, and greedy choice—that yield definitive algorithms for a variety of important computational tasks. The drawback of these tools is that they can only be used on very specific types of problems. We now turn to the two sledgehammers of the algorithms craft, dynamicprogrammingandlinearprogramming, techniquesofverybroadapplicability that can be invoked when more specialized methods fail. Predictably, this generality often comeswithacostinefficiency. 6.1 Shortestpathsindags,revisited
At the conclusionof ourstudy of shortest paths(Chapter 4), we observed thatthe problem is especiallyeasyindirectedacyclicgraphs(dags). Let’srecapitulatethiscase,becauseitliesat theheartofdynamicprogramming. Thespecialdistinguishingfeatureofadagisthatitsnodescanbelinearized;thatis,they can be arranged on a line so that all edges go from left to right (Figure 6.1). To see why this helps with shortest paths, suppose we want to figure out distances from node S to the other nodes. For concreteness, let’s focus on node D. The only way to get to it is through its
In the preceding chapters we have seen some elegant design principles—such as divide-andconquer, graph exploration, and greedy choice—that yield definitive algorithms for a variety of important computational tasks. The drawback of these tools is that they can only be used on very specific types of problems. We now turn to the two sledgehammers of the algorithms craft, dynamicprogrammingandlinearprogramming, techniquesofverybroadapplicability that can be invoked when more specialized methods fail. Predictably, this generality often comeswithacostinefficiency. 6.1 Shortestpathsindags,revisitedAt the conclusionof ourstudy of shortest paths(Chapter 4), we observed thatthe problem is especiallyeasyindirectedacyclicgraphs(dags). Let’srecapitulatethiscase,becauseitliesat theheartofdynamicprogramming. Thespecialdistinguishingfeatureofadagisthatitsnodescanbelinearized;thatis,they can be arranged on a line so that all edges go from left to right (Figure 6.1). To see why this helps with shortest paths, suppose we want to figure out distances from node S to the other nodes. For concreteness, let’s focus on node D. The only way to get to it is through its
การแปล กรุณารอสักครู่..

ในบทก่อนหน้านี้เราได้เห็นบางหลักการออกแบบที่หรูหราเช่นแบ่ง andconquer , การสำรวจ , กราฟและทางเลือกโลภที่ผลผลิต เดอ จึง nitive ขั้นตอนวิธีสำหรับความหลากหลายของงานคอมพิวเตอร์ที่สำคัญ ข้อเสียของเครื่องมือเหล่านี้คือการ ที่พวกเขาสามารถถูกใช้ในมากกาจึง C ประเภทของปัญหา . ตอนนี้เราเปิดสองค้อนของอัลกอริทึม ยานdynamicprogrammingandlinearprogramming techniquesofverybroadapplicability , ที่สามารถถูกเรียกเมื่อวิธีการเฉพาะมากกว่าล้มเหลว คาดการณ์ , สภาพทั่วไปนี้มักจะ comeswithacostinef จึงประสิทธิภาพ . 6.1 shortestpathsindags , เยือน
ที่ conclusionof ourstudy ของเส้นทางที่สั้นที่สุด ( บทที่ 4 ) เราพบปัญหาว่า มี especiallyeasyindirectedacyclicgraphs ( เดคากรัม ) let'srecapitulatethiscase ,becauseitliesat theheartofdynamicprogramming . thespecialdistinguishingfeatureofadagisthatitsnodescanbelinearized ; ซึ่งพวกเขาสามารถจัดเรียงบนบรรทัดเพื่อให้ขอบทั้งหมดไปจากซ้ายไปขวา ( รูป 6.1 ) เพื่อดูว่าทำไมนี้จะช่วยให้มีเส้นทางที่สั้นที่สุด สมมติว่าเราต้องการถ่ายทอดระยะทาง gure ออกจากโหนดกับโหนดอื่น ๆ สำหรับรูปธรรม ให้มุ่งเน้นไปที่โหนด Dวิธีเดียวที่จะได้รับมันผ่าน
การแปล กรุณารอสักครู่..
