代码实现
int findDepthInGenericTree(int p[],int n){
int maxDepth - -1;
int currentDepth = -1;
int j = 0;
for(int i = 0; i < n; i++){
currentDepth = 0;
j = i;
while(p[j] != -1){
currentDepth++;
j = p[i];
}
if(currentDepth > maxDepth){
maxDepth = currentDepth;
}
return maxDepth;
}
}