如何按字典顺序打印 trie backwords?

问题描述

这是我的代码,你能帮我改进这个代码以获得更好的结果吗? 在我的情况下,我需要单词列表如下:youd you
但在我的代码中,我得到了相反的答案。

   void postorder(struct triNode *follow,char str[],int d)
{
   int i = 0;
   if (follow == NULL)
   {
       return;
   }

   if (follow->endOfWord)
   {
       int b = follow->count;
       str[d] = 0;
       printf("%s %d \n",str,b);
   }

   for (i = NUM_LETTERS - 1; i >= 0; i--)
   {
       str[d] = 'a' + i;
       postorder(follow->children[i],d + 1);
   }
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)