ExamVeda
Login
Home
This question belongs to Data Structure Graphs
Graphs
?

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--; 
}

Answer & Solution
Correct Answer: Option B
Let's discuss the solution. Join the discussion
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.