gs gs122 Graph Search - Non-recursive Depth First Search - Quiz No.1
gs gs122 Data Communication and Computer Network Quiz
This quiz belongs to book/course code gs gs122 Data Communication and Computer Network of gs organization. We have 268 quizzes available related to the book/course Data Communication and Computer Network. This quiz has a total of 10 multiple choice questions (MCQs) to prepare and belongs to topic Graph Search. NVAEducation wants its users to help them learn in an easy way. For that purpose, you are free to prepare online MCQs and quizzes.
NVAEducation also facilitates users to contribute in online competitions with other students to make a challenging situation to learn in a creative way. You can create one to one, and group competition on an topic of a book/course code. Also on NVAEducation you can get certifications by passing the online quiz test.
procedure DFS-non_recursive(G,v): //let St be a stack St.push(v) while St is not empty v = St.pop() if v is not discovered: label v as discovered for all adjacent vertices of v do St.push(a) //a being the adjacent vertex
procedure DFS-non_recursive(G,v): //let St be a stack St.pop() while St is not empty v = St.push(v) if v is not discovered: label v as discovered for all adjacent vertices of v do St.push(a) //a being the adjacent vertex
procedure DFS-non_recursive(G,v): //let St be a stack St.push(v) while St is not empty v = St.pop() if v is not discovered: label v as discovered for all adjacent vertices of v do St.push(v)
procedure DFS-non_recursive(G,v): //let St be a stack St.pop(v) while St is not empty v = St.pop() if v is not discovered: label v as discovered for all adjacent vertices of v do St.push(a) //a being the adjacent vertex
void DFS(int s) { vector<bool> discovered(V, true); stack<int> st; st.push(s); while (!st.empty()) { s = st.top(); st.pop(); if (!discovered[s]) { cout << s << " "; discovered[s] = true; } for (auto i = adjacent[s].begin(); i != adjacent[s].end(); ++i) if (!discovered[*i]) st.push(*i); } }
void DFS(int s) { vector<bool> discovered(V, false); stack<int> st; st.push(s); while (!st.empty()) { s = st.top(); st.pop(); if (!discovered[s]) { cout << s << " "; discovered[s] = true; } for (auto i = adjacent[s].begin(); i != adjacent[s].end(); ++i) if (!discovered[*i]) st.push(*i); } }
void DFS(int s) { vector<bool> discovered(V, false); stack<int> st; st.push(s); while (!st.empty()) { st.pop(); s = st.top(); if (!discovered[s]) { cout << s << " "; discovered[s] = true; } for (auto i = adjacent[s].begin(); i != adjacent[s].end(); ++i) if (!discovered[*i]) st.push(*i); } }
void DFS(int s) { vector<bool> discovered(V, false); stack<int> st; st.push(s); while (!st.empty()) { s = st.top(); st.pop(); if (!discovered[s]) { cout << s << " "; discovered[s] = false; } for (auto i = adjacent[s].begin(); i != adjacent[s].end(); ++i) if (discovered[*i]) st.push(*i); } }