tailieunhanh - How to Design Programs phần 7

Ví dụ, thêm 10 số đầu tiên, ngay cả sản lượng 90, và thêm trong 10 số lẻ đầu tiên sản lượng 100. Tính toán một loạt rõ ràng là một công việc cho một máy tính. Dưới đây là chức năng mà thêm số đầu tiên n lẻ hoặc thậm chí, tương ứng, sử dụng làm và làm cho lẻ để tính toán các con số cần thiết: | e j VOj. -rOj o The function f is the derivative off and f r0 is the slope off at r0. Furthermore the root of a linear function is the intersection of a straight line with the x axis. In general if the line s equation is y rj z ft then its root is - b a. In our case the root offs tangent is -338- TEAM FLY PRESENTS Section 28 Algorithms that Backtrack Solving problems does not always proceed on a direct route to the goal. Sometimes we make progress by pursuing one approach only to discover that we are stuck because we took a wrong turn. In those cases we backtrack in our exploration and take a different turn at some branch in the hope that it leads us to a solution. Algorithms can proceed like that. In the first subsection we deal with an algorithm that can help us traverse a graph which is of course the situation we just discussed. The second subsection is an extended exercise that uses backtracking in the context of chess. On occasion we need to navigate through a maze of one-way streets. Or graph of whom we consider a friend whom they consider a friend and so plan a route through a network of pipelines. Or we ask the Internet to fin message from one place to another. Specifically there is always some collection of Ì represent one-way connections between the nod nodes the arrows between them are the one-way seven nodes and nine edges. Traversing Graphs e may wish to draw a n. Or we need to some way to send a All these situations share a common element a directed graph. odes and a collection of edges. The edges s. Consider figure 76. The black bullets are the connections. The sample graph consists of Now suppose we wish to plan routes in the graph of figure 76. For example if we plan to go from C to D the route is simple it consists of the origination node C and the destination node D. In contrast if we wish to travel from E to D we have two choices 1. We either travel from E to F and then to D. 2. Or we travel from E to C and then to D. For some nodes however

TÀI LIỆU MỚI ĐĂNG
34    198    1    29-03-2024
46    179    0    29-03-2024
14    159    0    29-03-2024
15    174    0    29-03-2024
5    114    0    29-03-2024
75    130    0    29-03-2024
crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.