卷別
資料結構與演算法
選擇國立臺灣大學 2024 · 考試 · 第 12 題
考科演算法
(5 points) Consider a directed acyclic graph of tasks where every node is a task and every edge is a dependency. If there is an edge from a task to another task , that means we need to finish before starting . We have processors of the same capability and every processor can finish any task in one unit of time.
We define a schedule function to map a task to a positive integer time step . Since we have only processors, so the system can only process at most tasks in one time step. Also, a schedule needs to respect the dependency of edges.
- (A)For every positive integer , .
- (B)If there is a path in , then for .
- (C)The number of time steps required is at least , where is the number of tasks along the longest path in .
- (D)Without loss of generality, we can always assume for all 's without incoming edges.
- (E)If the number of processors is infinite, then we can finish all tasks in time steps, where is the number of tasks along the longest path in .