Tries(contact list)


if we have to add a pair instead of single string…what changes we have to make…?

Hi tishya
If we have to make a pair instead of a string in trie, we just have to substitute the string keyword with pair. So now the data structure will look like pair <pair <data_type,data_type>, int> (data type like string, char, int whichever specified in question) and then wherever you were putting string in pair you first create a new pair<data_type, data_type> and then initialize it and then add it to the original pair data element of the trie class.

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.