if leaf node then print key
if ( node -> child [ i ] -> index != -1 ) cout << arr [ node -> child [ i ] -> index ] << endl ; preorder ( node -> child [ i ] , arr ) ; } } } void printSorted ( string arr [ ] , int n ) { Trie * root = new Trie ( ) ;