Here is Depth First Traversal Algorithm
// Consoder Graph G(V.E)
Bool Visited[V] = {False};
DFT(V,E){
for each vertex v, element of V do
if(!(visited[v]))
DFS(v);
}
DFS(v){
visited[v] = True;
for each vertex w adjacent to v do
if(!(visited[w]))
DFS(w);
}
Here is the Depth First Search Algorithm,
//Consider Graph G(V,E)
Bool visited[V] = {False};
DFS(v){ // Take V as startig vertex
visited[v] = True;
for each vertex w adjacent to v do
if(!(visited[w]))
DFS(w);
}
Now observe the difference.
1) DFT is a a traversal which usually applied on the disconnected Graph. While DFS is an algorithm which is applied on the connected graph.
2) DFS did not gurantee that it will visit each and every node while DFT do.
3) DFT uses DFS.
==> Both uses stack and Visited array, as you have asked.
P.S. I have read this in DAA notes by ACE. Posted in Facebook Group.