老师在讲这个根据前序,中序的结果重建二叉树的时候,事实上是给出了流程图的,但递归的方法更简单: 然后看看left和right的构造就行了: 那么代码是不是也很简单呢: struct node *rebuild(int *Preorder, int *Inorder, int StartPre, int EndPre, int StartMid, int EndMid) { struct node *root; int distance; if (StartPre > EndPre || S
作者:dog250 发表于 2020/09/26 08:37:58 原文链接 http://it.taocms.org/09/41205.htm
阅读:2788 评论:6 查看评论
网友评论已有0条评论, 我也要评论