有人可以告诉我n-ary树中的二维数组究竟用于什么?
#include <stdio.h>
int main()
{
int row = 5;//no. of input lines
//1st element in each row is node Value, 2nd - no of child, ,>=3rd....=>value of child
int data[5][6];
int i,j,k,m;
for (i=0;i<5;i++)
{
printf("\nEnter value of Node:\t");
for(j=0;j<6;j++)
{
if(j==1)
printf("\nEnter no of child:\t");
else if(j==2)
printf("\nEnter Values of child\n(if child not present enter 0 as value):\t");
scanf("%d",&data[i][j]);
}
}
答案 0 :(得分:0)
看起来像你所说的n阵列树是由2d数组表示的。它用作存储数据的下划线数据结构。