Thank you so much for the comment Xiongqi. I hate to tell that the BFS is a mistake, I forgot to remove it after I decided to use DFS. :)
I have notice this line. curr = curr->subTrie[idx]; at searchNextLevel function. But I pre-examined all the possible index values at last function being called. Please refer to gotAbsent, if gotAbsent is true, there is no chance to call next level. So if this is the bug, there must be something wrong with the trie, or something I don't know about the test data. Would you provide a case that may break it? Thank you, Jian On Sunday, May 6, 2018 at 4:02:38 AM UTC-4, Xiongqi ZHANG wrote: > in searchNextLevel() > there is a line > > curr = curr->subTrie[idx]; > This can result in curr being null. > and later there is another line > > if (curr->subTrie[idx2] == NULL) > > which might throw is curr is null > > In general, your code is not doing what you want it to do (BFS base on your > comment) -- You received this message because you are subscribed to the Google Groups "Google Code Jam" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/google-code/052be1e2-b27b-43a9-b808-694d2fc6c2fc%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
