后续遍历的实现:
数据结构树中的后续遍历,这里提供简单实例,代码中有注释,大家参考下!
看下实现效果:
题目及分析
给定树的先序遍历和中序遍历,求后续遍历
输入
abdec
dbeac
输出
debca
三、实现代码:
#include#include using namespace std; string s1="abdec";//先序遍历 string s2="dbeac";//中序遍历 void calc(int l1,int r1,int l2,int r2){ int m=s2.find(s1[l1]); //cout< l2) calc(l1+1,l1+m-l2,l2,m-1); if(m 感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!



