For this Question: Given a tree rooted at node 1, find the height of the tree. The height of the tree is the maximum number of edges between the root node and any node of the tree.First line contains N, the number of nodes in the tree. 
N-1 lines follow containing u and v denoting an edge between node u and node v.
The input is guaranteed to be a tree.

1 <= N <= 100000
1 <= u,v <= N
u != vOutput a single integer containing the height of the tree.Sample Input
4
1 2
2 3
1 4

Sample output 
2 

Sample Input 
3
1 2
2 3

Sample output
2, I have written this Solution Code: #include<bits/stdc++.h>
using namespace std;

int maxheight(vector<int> tree[], int node, bool visited[]){
	int height = 0;
	for(auto child: tree[node]){
		if(visited[child])
			continue;

		visited[child] = true;
		height = max(height, maxheight(tree, child, visited) + 1);	
	}
	return height;
}

int main(){
	int n;
	cin>>n;
	bool visited[n+1] ={0};

	vector<int> tree[100001];
	for(int i=0; i<n-1; i++){
		int u, v;
		cin>>u>>v;
		tree[u].push_back(v);
		tree[v].push_back(u);
	}

	visited[1] = true;
	cout<< maxheight(tree, 1, visited)<< endl;

	return 0;
}, In this Programming Language: C++, Now tell me if this Code is compilable or not?