Topological sort is best defined as which of the following?
- A. A sorting algorithm that repeatedly selects the smallest remaining element and moves it to its correct position.
- B. A sorting algorithm that builds the final sorted array one element at a time by inserting each element into its correct position.
- C. An ordering of vertices in a directed acyclic graph such that for every edge, the source vertex comes before the destination vertex. ✓
- D. A comparison-based sorting algorithm that uses a binary heap data structure to sort elements.
Correct answer
C. An ordering of vertices in a directed acyclic graph such that for every edge, the source vertex comes before the destination vertex.
Explanation
Topological sort refers to an ordering of vertices in a directed acyclic graph such that for every edge, the source vertex comes before the destination vertex.