hi guyz,
i have the algorithms for BFS and DFS.Here is mine........
i tried implementing them and error occured.....can someone help me with code
/*Q = new queue
Q.enq(v)
mark v as visited
while Q is not empty ////////BFS
curr = Q.deq()
print curr
for each w in adj(curr)
if w is not visited
Q.enq(w)
mark w as visited*/
/////DFS
s = new stack
s.push(v)
mark v as visited
while s is not empty
curr =s.top()
if every vertex in adj(curr)
is visited
s.pop()
else
let w be an unvisited vertex in adj(curr)
s.push(w)
print and mark w as visited