240 views

1 Answer

0 votes
0 votes

I think option C is the answer. Since the program uses 'mark' field to identify the counted nodes we have to set mark=1 somewhere in the program. So that leaves us with option A and C.
Lets look at option A, if we put a->mark=1 as the first statement then the If condition gets satisfied and the program ends there.

Therefore the line should be after the if statement

If(a->mark) return 0;

a->mark=1;

Related questions

2 votes
2 votes
2 answers
1
aaru14 asked Sep 7, 2017
390 views
a sorted array of n elements contains 0 and 1. to find out majority of 0 and 1 how much ime it will take?1)O(1)2)O(logn)3)O(n)4)O(n^2)
0 votes
0 votes
2 answers
2
viral8702 asked Sep 21, 2023
285 views
The Total Combinations Possible of Min heap with 8 Distinct elements are ?
0 votes
0 votes
1 answer
3
iamdeepakji asked Jan 27, 2019
278 views
If there is negative edge cycle then dijkstra algorithm will give correct path or not same thing about bellman ford also?Bellman ford always halts or not?
0 votes
0 votes
1 answer
4
iamdeepakji asked Dec 27, 2018
402 views
Please solve this by taking some exampleBack edgecross edgetree edgeThankyou.