function to insert elements of the tree to map m
void insertToHash ( Node * root , unordered_set < int > & s ) { if ( ! root ) return ; insertToHash ( root -> left , s ) ; s . insert ( root -> data ) ; insertToHash ( root -> right , s ) ; }