Let $T$ be a Depth First Tree of a undirected graph $G$. An array $P$ indexed by the vertices of $G$ is given. $P[V]$ is the parent of vertex $V$, in $T$. Parent of the root is the root itself.
Give a method for finding and printing the cycle formed if the edge $(u,v)$ of $G$ not in $T$ (i.e., $e \in G-T$) is now added to $T$.
Time taken by your method must be proportional to the length of the cycle.
Describe the algorithm in a PASCAL $(C)$ – like language. Assume that the variables have been suitably declared.