nguyentruong98

Untitled

Dec 9th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.47 KB | None | 0 0
  1.       pushStack(q, start);
  2.       while (q->head != NULL)
  3.       {
  4.             prev_node[k] = v;
  5.             v = topStack(q);
  6.             popStack(q);
  7.             if(v == end)
  8.             break;
  9.             visitedarray[v] = 1;
  10.             for (int i = 1; i <= n; i++)
  11.             {
  12.                   if (map[v][i] && !visitedarray[i])
  13.                         pushStack(q, i);
  14.             }
  15.       }
  16.       for(i = 1; i <= k; i++)
  17.       {
  18.             printf("%d\n", prev_node[i]);
  19.       }
Advertisement
Add Comment
Please, Sign In to add comment