edited by
828 views

2 Answers

Best answer
2 votes
2 votes

Explanation on how answer could be option C

$v_7$ is the last node that should be pushed on the stack.

But there is a possibility that there exists some code which does not push the last node on the stack,
for doing such a thing it is required, say, to maintain a counter for number of nodes being pushed to the stack. Its good to maintain such a counter, this saves us from unnecessary push and checks for visited marked nodes, once nodes except one are already traversed.

$v7$ turns out to be the last node.

Hence, answer = option C

edited by
3 votes
3 votes
Adjacent element of v7 i.e. 6 and 8 already visit by v4 and v6..thats y need nod to push inti stack

Related questions