Implementation of tries

if( temp->children.count(ch) )
elaborate this statement?

hello @khemchandrs,
temp->children is a map. temp->children.count(ch) return 1 if key ch is present in map otherwise 0.

and also tell why are we need count variable ?

@khemchandrs
if count will return 1 that means children node with value ch already exist so no need to create any new children .directly move to that children.
otherwise if count return 0 . that means no such children with value ch exist so we first need to create children node with value ch and then move to that children

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.