What Would Be The Output Of The Following C Program If The #1262
What would be the output of the following C++ program if the given input is </p> <pre><code class="language-cpp"> 0 0 0 1 1 0 0 0 0 1 0 0 0 1 0 1 0 1 0 0 1 1 0 0 0 #include <bits/stdc++.h> using namespace std; bool visited[5]; int G[5][5]; void fun(int i) { cout<<i<<" "; visited[i]=true; for(int j=0;j<5;j++) if(!visited[j]&&G[i][j]==1) fun(j); } int main() { for(int i=0;i<5;i++) for(int j=0;j<5;j++) cin>>G[i][j]; for(int i=0;i<5;i++) visited[i]=0; fun(0); return 0; } </code></pre>
This multiple choice question (MCQ) is related to the book/course gs gs121 Data Structures and Algorithms. It can also be found in gs gs121 Graph - Directed Acyclic Graph - Quiz No.1.
Similar question(s) are as followings:
Online Quizzes of gs121 Data Structures and Algorithms
Binary Trees - Binary Search Tree - Quiz No.1
gs gs121 Data Structures and Algorithms
Online Quizzes
Binary Trees - Binary Search Tree - Quiz No.2
gs gs121 Data Structures and Algorithms
Online Quizzes
Binary Trees - Preorder Traversal - Quiz No.1
gs gs121 Data Structures and Algorithms
Online Quizzes