Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Let G = (V, E) be a complete directed acyclic graph that has an edge between eve

ID: 3777252 • Letter: L

Question

Let G = (V, E) be a complete directed acyclic graph that has an edge between every pair of vertices and whose vertices are labeled 1, 2, ..., n, where n = |V|. To determined the direction of an edge between two vertices in V, you are only allowed to ask a query. A query consists of two specified vertices u and v and is answered as follows: "from u to v" if (u, v) elementof E, or "from v to u" if (v, u) 6 E Give a worse-case lower bound (as a function of n) for the number of queries required to find a topological sort of G.

Explanation / Answer

Things to note are:-


1. Graph is complete
2. There exists ordering between every pair of vertices.
3. By asking a query we are establishing some kind of Ordering between two nodes i.e from u to v means u > v and vice versa

So from the point 3 and using the Hint given, we can find Topological sort using Comparison based Sorting
Lets see How ?


Run a sorting algorithm and in the comparison section use query i.e Comparing Two vertices by asking the query we can know whether u>v or v>u . The output will have the Ordering of all the vertices where the first node will be the one whose indegree is 0 and the last node will be the one whose outdegree is 0 , Hence we get the output of Topological Sort

Worst Case lower bound

I
n comparsion based sort the Worst Case lower bound is (nlogn), hence to find the topological sort the lower bound is nlogn

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote