For Which Type Of Graph The Given Program Wont Run Infinitely #1212
For which type of graph, the given program won’t run infinitely? The Input would be in the form of an adjacency Matrix and n is its dimension (1<n<10).</p> <pre><code class="language-cpp"> #include <bits/stdc++.h> using namespace std; int G[10][10]; void fun(int n); int main() { int num=0; int n; cin>>n; for(int i=0;i<n;i++) for(int j=0;j<n;j++) cin>>G[i][j]; fun(n); return 0; } void fun(int n) { for(int i=0;i<n;i++) for(int j=0;j<n;j++) if(G[i][j]==1) j--; } </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 - Adjacency Matrix - Quiz No.2.
For which type of graph, the given program won’t run infinitely? The Input would be in the form of an adjacency Matrix and n is its dimension (1<n<10).
#include <bits/stdc++.h> using namespace std; int G[10][10]; void fun(int n); int main() { int num=0; int n; cin>>n; for(int i=0;i<n;i++) for(int j=0;j<n;j++) cin>>G[i][j]; fun(n); return 0; } void fun(int n) { for(int i=0;i<n;i++) for(int j=0;j<n;j++) if(G[i][j]==1) j--; }
All Fully Connected Graphs
All Empty Graphs
All Bipartite Graphs
All simple graphs
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