Function to count the frequency of node value present in the tree
static void frequencyCounts ( Dictionary < int , int > map , Node root ) { if ( root == null ) return ; if ( map . ContainsKey ( root . key ) ) map [ root . key ] = map [ root . key ] + 1 ; else map [ root . key ] = 1 ; frequencyCounts ( map , root . left ) ; frequencyCounts ( map , root . right ) ; }