Practice question · Multiple choice
Task dependencies form a partial order and topological sort produces a valid build order. Why does the algorithm need a partial order rather than a total one?
Hints
- Two independent modules: which should be built first?
- Ask what a total order would be asserting about every pair of tasks.
Show the answer
C. Because most tasks are genuinely incomparable
Why
Most pairs of tasks have no relationship, and a partial order says so, which is exactly the information a build system exploits to run them in parallel. A total order would invent constraints that do not exist. Option 4 has it backwards: a cycle means a circular dependency, which is the error a build tool reports.
Practise Relations
The app has 5 more questions on this lesson, and keeps your place in the course. Computer Science I is free to start.
More questions on Relations
- Congruence mod 5 partitions the integers into exactly five classes, while "less than or equal to" partitions…
- You are handed an unfamiliar relation and want to know whether it partitions its set into classes. Order the…
- R is the relation 'has the same remainder when divided by 4' on the integers. Select every pair of numbers…
- Because 'divides' is transitive on the positive integers, knowing 3 divides 12 and 12 divides 60 is enough to…