Trie printing function

PHOTO EMBED

Sat Jun 24 2023 05:07:28 GMT+0000 (Coordinated Universal Time)

Saved by @DxBros #dfs #c++ #print_trie

void print(TrieNode* root, string t,vector<string>& s ){
        int cnt_nulls = 0;
        for(int i = 0; i < 26; i++){
            if(root->v[i] != NULL){
                char c = (i + 'a');
                // cout << c << endl;
                t.push_back(c);
                print(root->v[i] , t, s);
                t.pop_back();
            }
            else cnt_nulls++;
        }
        if(cnt_nulls == 26)
            s.push_back(t);
    }
content_copyCOPY

used to print trie

https://practice.geeksforgeeks.org/problems/prefix-match-with-other-strings/1