i want convert to code C++

Page 1 of 1

2 Replies - 145 Views - Last Post: 05 January 2011 - 02:10 PM Rate Topic: -----

#1 Samer AL-Shanti  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 05-January 11

i want convert to code C++

Posted 05 January 2011 - 01:53 PM

BFS(G, s) {
    // initialize vertices;
	 for each u  V(G) – {s}{
		do color[u] = WHITE
		   d[u] = 		// distance from s to u
		   p[u] = NIL		// predecessor or parent of u
    }
   color[s] = GRAY
   d[s] = 0
   p[s] = NIL
	 Q = Empty;
 	 Enqueue (Q,s);		// Q is a queue; initialize to s
  while (Q not empty) {    
      u = Dequeue(Q);
      for each v  adj[u] {
          if (color[v] == WHITE)
              color[v] = GRAY;
              d[v] = d[u] + 1;
              p[v] = u;
              Enqueue(Q, v);
        }
      color[u] = BLACK;
    }
}

This post has been edited by ishkabible: 05 January 2011 - 02:04 PM
Reason for edit:: use code tags!!


Is This A Good Question/Topic? 0
  • +

Replies To: i want convert to code C++

#2 ishkabible  Icon User is offline

  • spelling expret
  • member icon




Reputation: 1622
  • View blog
  • Posts: 5,709
  • Joined: 03-August 09

Re: i want convert to code C++

Posted 05 January 2011 - 02:08 PM

1) use code tags!!
2) what language is it?
3) what have you tried?

(I'm just complaining here)
4) can you please reiterate your question in your topics, i hate (and maybe it's just a pet peeve of mine) when people don't do that. i can easily infer and even conclude what your asking from your title but i don't want to. i want you to elaborate if possible and if it is so simple that there is no need to elaborate then restate you question in the topic please.

This post has been edited by ishkabible: 05 January 2011 - 02:08 PM

Was This Post Helpful? 0
  • +
  • -

#3 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6035
  • View blog
  • Posts: 23,418
  • Joined: 23-August 08

Re: i want convert to code C++

Posted 05 January 2011 - 02:10 PM

No, this is no better than a GIVE ME THE CODES! post. We will NOT do this for you.

Closed.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1