索引超出了数组界限。
Error code :
if ( nums == 0)
{
array[i]++; // 此句错误 ???
//caculate degree to vertex i 's 计算顶点I的度 }Program: public int[] CountNums(int nums)
{
//nums = edges nums
int n = 0;// vertex nums
int[] array = new int[n]; //save vertex degree of the matrix here .
for (int i = 0; i <=array.Length; i++)
{
for (int j = 0; j <=array.Length; j++)
{
if ( nums == 0)
{
array[i]++;
//caculate degree to vertex i 's 计算顶点I的度 }
}
}
nums++;
return array;
}
统计一个采用邻结矩阵存储,具有N个顶点的无向图无权图的所有顶点的度。
Error code :
if ( nums == 0)
{
array[i]++; // 此句错误 ???
//caculate degree to vertex i 's 计算顶点I的度 }Program: public int[] CountNums(int nums)
{
//nums = edges nums
int n = 0;// vertex nums
int[] array = new int[n]; //save vertex degree of the matrix here .
for (int i = 0; i <=array.Length; i++)
{
for (int j = 0; j <=array.Length; j++)
{
if ( nums == 0)
{
array[i]++;
//caculate degree to vertex i 's 计算顶点I的度 }
}
}
nums++;
return array;
}
统计一个采用邻结矩阵存储,具有N个顶点的无向图无权图的所有顶点的度。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货