sir mera code kyu nahi chal raha hai
Digital dictionary problem
Hey @YASHMATHURIA123,
-
Firstly, cross-verify your code with the following:
https://ide.codingblocks.com/s/267345 -
Also, the output format of your code is incorrect.
-
You have to insert a string into the trie if it is not found.
Let me know, if still can’t find the error.
sir aap ek baari dfs ko expalin kaaro ge aur aapne root==null kaise aaya gaa kyuki hum node banate samahe kuch null ka use hi nahi kar raha hai class node m
Hello @YASHMATHURIA123,
-
dfs function will be used to print all the string which have string w as their prefix.
suppose w=“pet”
the trie we have created is like:
p
\
e
\
t
/ \
s r
So, after w i.e. pet
we will pass root as node with value t and w in the dfs
Then the for loop will one by one append children character of root t.
So, obtained strings are:
pets and petr -
i.e. base case is not required.
As you have stated the reason.