大家伙儿帮看看!已知某棵二叉树的前序遍历结果为A,B,D,E,G,C,F,H,I,J,其中中序遍历的结果为D,B,G,E,A,H,F,I,J,C。(1)请画出这棵二

大家帮看看!已知某棵二叉树的前序遍历结果为A,B,D,E,G,C,F,H,I,J,其中中序遍历的结果为D,B,G,E,A,H,F,I,J,C。(1)请画出这棵二
已知某棵二叉树的前序遍历结果为A,B,D,E,G,C,F,H,I,J,其中中序遍历的结果为D,B,G,E,A,H,F,I,J,C。(1)请画出这棵二叉树。(2)给出后序遍历的结果。
------解决方案--------------------
http://blog.****.net/binghuazh/archive/2009/10/06/4636012.aspx


这是由前序,中序推后序的代码。

string calOrder(string preOrder,string inOrder)   
{   
    if(preOrder.size() == 1 
------解决方案--------------------
 preOrder.size() == 0)   
        return preOrder;   
    else  
    if(inOrder.size() == 1 
------解决方案--------------------
 inOrder.size() == 0)   
        return inOrder;   
    else  
    {   
        int index = inOrder.find(preOrder[0]);   
        string lpo = preOrder.substr(1,index);   
        string lio = inOrder.substr(0,index);   
       
        string hpo = preOrder.substr(index+1);   
        string hio = inOrder.substr(index+1);   
        return calOrder(lpo,lio) + calOrder(hpo,hio) + inOrder[index];   
    }   
}  




------解决方案--------------------
忘完了
------解决方案--------------------
楼上,单知道前序和后序的序列,不能确定一棵二叉树吧~~
------解决方案--------------------
这个找个例子看看,不难推吧