Language: C++

#include <iostream>
using namespace std;
#define MAX 100005
#define NIL -1
 
struct Node { int p, l, r;};
 
Node T[MAX];
int n, D[MAX];
 
void setDepth(int u,int d){
if (u==NIL) return;
D[u] = d;
setDepth(T[u].left,d+1);
setDepth(T[u].right,d+1);
}
int setHeight(int u){
int h1 = 0,h2 = 0;
if(T[u].left !=NIL)
h1 = setHeigh(T[u].left)+1;
	if(T[u].right !=NIL)
	h2 =setHeight(T[u].right)+1;
	return H[u] = (h1>h2?h1:h2);
}

int getSiblimg(int u){
	if(T[u].parent == NIL)return NIL;
	if(T[T[u].parent].left !=u&&T[T[u].parent].left !=NIL)
	return T[T[u].parent].left;
	if(T[T[u].parent].right!=u&&T[T[u].parent].right!=NIL);
	return T[T[u].parent].right;
	return NIL;
}
void printf(int u){
	printf("node %d: ",u);
	printf("parent = %d,",T[u].parent);
	printf("sibling  %d,",getSibling(u));
	int deg = 0;
	if(T[u].left !=NIL) deg++;
	if(T[u].right !=NIL) deg++;
	printf("degree = %d, ",deg);
	printf("depth = %d, ",D[u]);
	printf("hight = %d, ",H[u]);
	
	if(T[u].parent == NIL){
		printf("root\n");
	}else if(T[u].left == NIL && T[u].right == NIL){
		printf("leaf\n");
	}else{
		primtf("internal node\n");
	}}
int main(){
	int v,l,r,root=0;
	scanf("%d",&n);
	for(int i=0;i<n;i++)T[i].parent = NIL;
	for(int i=0;i<n;i++){
		T[v].left = l;
		T[v].right = r;
		if(l!=NIL)T[l].parent = v;
		if(r!=NIL)T[r].parent = v;}
	for (int i=0;i<n;i++)if(T[i].parent == NIL) root=i;
	setDepth(root,0);
	setHeight(root);
	
	for(int i=0;i<n;i++)print(i);
	
	return 0;
}


Compiler output:
a.cc: In function 'void setDepth(int, int)':
a.cc:14:15: error: 'struct Node' has no member named 'left'
   14 | setDepth(T[u].left,d+1);
      |               ^~~~
a.cc:15:15: error: 'struct Node' has no member named 'right'
   15 | setDepth(T[u].right,d+1);
      |               ^~~~~
a.cc: In function 'int setHeight(int)':
a.cc:19:9: error: 'struct Node' has no member named 'left'
   19 | if(T[u].left !=NIL)
      |         ^~~~
a.cc:20:20: error: 'struct Node' has no member named 'left'
   20 | h1 = setHeigh(T[u].left)+1;
      |                    ^~~~
a.cc:20:6: error: 'setHeigh' was not declared in this scope; did you mean 'setHeight'?
   20 | h1 = setHeigh(T[u].left)+1;
      |      ^~~~~~~~
      |      setHeight
a.cc:21:17: error: 'struct Node' has no member named 'right'
   21 |         if(T[u].right !=NIL)
      |                 ^~~~~
a.cc:22:28: error: 'struct Node' has no member named 'right'
   22 |         h2 =setHeight(T[u].right)+1;
      |                            ^~~~~
a.cc:23:16: error: 'H' was not declared in this scope
   23 |         return H[u] = (h1>h2?h1:h2);
      |                ^
a.cc: In function 'int getSiblimg(int)':
a.cc:27:17: error: 'struct Node' has no member named 'parent'
   27 |         if(T[u].parent == NIL)return NIL;
      |                 ^~~~~~
a.cc:28:19: error: 'struct Node' has no member named 'parent'
   28 |         if(T[T[u].parent].left !=u&&T[T[u].parent].left !=NIL)
      |                   ^~~~~~
a.cc:28:44: error: 'struct Node' has no member named 'parent'
   28 |         if(T[T[u].parent].left !=u&&T[T[u].parent].left !=NIL)
      |                                            ^~~~~~
a.cc:29:23: error: 'struct Node' has no member named 'parent'
   29 |         return T[T[u].parent].left;
      |                       ^~~~~~
a.cc:30:19: error: 'struct Node' has no member named 'parent'
   30 |         if(T[T[u].parent].right!=u&&T[T[u].parent].right!=NIL);
      |                   ^~~~~~
a.cc:30:44: error: 'struct Node' has no member named 'parent'
   30 |         if(T[T[u].parent].right!=u&&T[T[u].parent].right!=NIL);
      |                                            ^~~~~~
a.cc:31:23: error: 'struct Node' has no member named 'parent'
   31 |         return T[T[u].parent].right;
      |                       ^~~~~~
a.cc: In function 'void printf(int)':
a.cc:36:36: error: 'struct Node' has no member named 'parent'
   36 |         printf("parent = %d,",T[u].parent);
      |                                    ^~~~~~
a.cc:37:31: error: 'getSibling' was not declared in this scope; did you mean 'getSiblimg'?
   37 |         printf("sibling  %d,",getSibling(u));
      |                               ^~~~~~~~~~
      |                               getSiblimg
a.cc:39:17: error: 'struct Node' has no member named 'left'
   39 |         if(T[u].left !=NIL) deg++;
      |                 ^~~~
a.cc:40:17: error: 'struct Node' has no member named 'right'
   40 |         if(T[u].right !=NIL) deg++;
      |                 ^~~~~
a.cc:43:31: error: 'H' was not declared in this scope
   43 |         printf("hight = %d, ",H[u]);
      |                               ^
a.cc:45:17: error: 'struct Node' has no member named 'parent'
   45 |         if(T[u].parent == NIL){
      |                 ^~~~~~
a.cc:47:23: error: 'struct Node' has no member named 'left'
   47 |         }else if(T[u].left == NIL && T[u].right == NIL){
      |                       ^~~~
a.cc:47:43: error: 'struct Node' has no member named 'right'
   47 |         }else if(T[u].left == NIL && T[u].right == NIL){
      |                                           ^~~~~
a.cc:50:17: error: 'primtf' was not declared in this scope; did you mean 'printf'?
   50 |                 primtf("internal node\n");
      |                 ^~~~~~
      |                 printf
a.cc: In function 'int main()':
a.cc:55:34: error: 'struct Node' has no member named 'parent'
   55 |         for(int i=0;i<n;i++)T[i].parent = NIL;
      |                                  ^~~~~~
a.cc:57:22: error: 'struct Node' has no member named 'left'
   57 |                 T[v].left = l;
      |                      ^~~~
a.cc:58:22: error: 'struct Node' has no member named 'right'
   58 |                 T[v].right = r;
      |                      ^~~~~
a.cc:59:32: error: 'struct Node' has no member named 'parent'
   59 |                 if(l!=NIL)T[l].parent = v;
      |                                ^~~~~~
a.cc:60:32: error: 'struct Node' has no member named 'parent'
   60 |                 if(r!=NIL)T[r].parent = v;}
      |                                ^~~~~~
a.cc:61:38: error: 'struct Node' has no member named 'parent'
   61 |         for (int i=0;i<n;i++)if(T[i].parent == NIL) root=i;
      |                                      ^~~~~~
a.cc:65:29: error: 'print' was not declared in this scope; did you mean 'printf'?
   65 |         for(int i=0;i<n;i++)print(i);
      |                             ^~~~~
      |                             printf