What is my mistake in implimentation of a trie


here is the code

@hhiteshbansal_40d12e2460a1738e,
u have not taken input of the word u r finding else implementation seems good

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

no i have taken the input but error some is coming

@hhiteshbansal_40d12e2460a1738e, send ss of error, i didnt got any

@hhiteshbansal_40d12e2460a1738e, the code u send didnt had
char w[10];
after this add cin>>w;

source.cpp:9:5: error: ‘unordered_map’ does not name a type
9 | unordered_map<char, node *> children;
| ^~~~~~~~~~~~~
source.cpp: In member function ‘void trie::insert(char*)’:
source.cpp:36:23: error: ‘class node’ has no member named ‘children’
36 | if (temp->children.count(ch))
| ^~~~~~~~
source.cpp:38:28: error: ‘class node’ has no member named ‘children’
38 | temp=temp->children[ch];
| ^~~~~~~~
source.cpp:42:23: error: ‘class node’ has no member named ‘children’
42 | temp->children[ch]=n;
| ^~~~~~~~
source.cpp: In member function ‘bool trie::find(char*)’:
source.cpp:54:22: error: ‘class node’ has no member named ‘children’
54 | if(temp->children.count(ch)==0){
| ^~~~~~~~
source.cpp:58:28: error: ‘class node’ has no member named ‘children’
58 | temp=temp->children[ch];
| ^~~~~~~~

this error is coming

@hhiteshbansal_40d12e2460a1738e,
using namespace std;
was also missing i thought u missed while sending me + cin>>w;

now in output it is always showing not present why ???


I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

what thing have you corrected

@hhiteshbansal_40d12e2460a1738e, nothing except above said 2

please explain in brief what is my mistake and how it is affecting my problem

@hhiteshbansal_40d12e2460a1738e,
as such no mistake was there just i added just
using namespace std;
and cin>>w;