retagged by
791 views
3 votes
3 votes

Let $T$ be a depth-first search tree of a connected undirected graph $G$. For each vertex $v$ of $T$,

Let pre$\left ( v \right )$ be the number of nodes visited up to and including $v$ during a preorder traversal of $T$ , and post$\left ( v \right )$ means greater than and equal to  be the number of nodes visited up to and including $v$ during a postorder traversal of $T$.

The lowest common ancestor of vertices $u$ and $v$ in $T$ is a vertex $w$ of $T$ such that $w$ is an ancestor of both $u$ and $v$, and no child of w is an ancestor of both $u$ and $v$.

Let $\left ( u, v \right )$  be an edge in G that is not in T, such that pre$\left ( u \right )$ $<$ pre$\left ( v \right )$ . Which of the following statements about $u$ and $v$ must be true?

  1. post$\left ( u \right )$  $<$ post$\left ( v \right )$ 
  2. $u$ is an ancestor of $v$ in $T$.
  3. If $w$ is the lowest common ancestor of $u$ and $v$ in $T$, then $w = u$.
  1. II only
  2. III only
  3. I and II
  4. II and III
retagged by

2 Answers

Best answer
5 votes
5 votes

II) True - 

As we know pre(u) < pre(v) , that means u is explored before v in the dfs

 Given - (u, v) be an edge in G that is not in T ,

so that means there is another path to reach from u to v , like u -> x -> v ( had there been no other path , direct edge from u to v would be selected when performing Dfs)

This satisfies II)

III) is also true based on the above.

So option D.

[ see Anusha's example and apply the above . And dont get confused with Anscestor and Parent, the question says anscestor ]

edited by
0 votes
0 votes
ans should be C. for sentence I we can understand with any sample tree.

for sentence III w is lowest common ancestor of v. that mean an edge(w,v) is there. now if we take w=u than edge (u,v) will be there.  but it is already given in question that (u,v) is not present in T. so III is false.
Answer:

Related questions