Question: visited [ 1 - - n ] = 0 ; finished [ 1 - n ] = 0 ; out 1 - - n ;

visited [1--n]=0; finished [1-n]=0; out 1--n; stage [1-n]=1;
for i=1 to n
for j1 to n
if G[i][j]=1
out [i]= out [i]+1;
for i=1 to n
if out [i]=0 then g@(i)
go(i)
visited [i]=1;for j=1 to n
if G[j][i]=1
out [i]=out[i]+1;
for i=1 to n
if G[i][j]=1
if visited [j]=1
if finished =0
end; cycle;
else go(j)
ifgo(j)
stage [i]stage[j]
finished [i]=1
this pseudo code for the topological sort algorithm i need to compute it as a simple C code using the exact functions in the code above . And i need the explanation of it line by line please (i need a full code that works)
 visited [1--n]=0; finished [1-n]=0; out 1--n; stage [1-n]=1; for i=1 to

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!