Function to count the frequency of node value present in the tree
void frequencyCounts ( unordered_map < int , int > & map , Node * root ) { if ( root == NULL ) return ; map [ root -> key ] ++ ; frequencyCounts ( map , root -> left ) ; frequencyCounts ( map , root -> right ) ; }