• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            The Fourth Dimension Space

            枯葉北風寒,忽然年以殘,念往昔,語默心酸。二十光陰無一物,韶光賤,寐難安; 不畏形影單,道途阻且慢,哪曲折,如渡飛湍。斬浪劈波酬壯志,同把酒,共言歡! -如夢令

            已知先序+中序遍歷求后序遍歷(模板類)

             

            #include<iostream>
            #include
            <string>
            #include
            <algorithm>
            using namespace std;
            //////////////////////////////////////////////////////////////////////////////////////////
            ///                                    Pre_in_to_pos class
            ///        此類封裝了能夠將樹的先序遍歷和中序遍歷轉化成后序遍歷的操作(AC北大pku2255)
            ///                                                    -By abilitytao
            ///                                                            2009年5月24日
            //////////////////////BEGIN_TEMPLATE_BY_ABILITYTAO_ACM/////////////////////////////////////

            class Pre_in_to_pos
            {

            private:
                
            string pre;
                
            string in;
                
            string post;
                
            void trans(string a,string b);
            public:
                Pre_in_to_pos()
                
            {

                    pre.erase();
                    
            in.erase();
                    post.erase();
                }

                
            int inputpre();
                
            int inputpre(string a)
                
            {

                    pre
            =a;
                    
            return 1;
                }

                
            int inputin();
                
            int inputin(string a)
                
            {

                    
            in=a;
                    
            return 1;
                }


                
            void trans();
                
            void output();
                
            void clear();
            }
            ;

            int Pre_in_to_pos::inputpre()
            {

                cin
            >>pre;
                
            return 1;
            }


            int Pre_in_to_pos::inputin()
            {

                cin
            >>in;
                
            return 1;
            }


            void Pre_in_to_pos::trans(string a,string b)
            {

                
            int k=a.find(b.substr(0,1));
                
            if(k>0)
                    trans(a.substr(
            0,k),b.substr(1,k));
                
            if(k<a.length()-1)
                    trans(a.substr(k
            +1,a.length()-1-k),b.substr(k+1,b.length()-1-k));
                post
            +=a[k];
            }


            void Pre_in_to_pos::trans()
            {
                post.erase();
                trans(
            in,pre);
            }


            void Pre_in_to_pos::output()
            {

                cout
            <<post;
            }
            //沒有預置回車;


            /////////////////////END_TEMPLATE_BY_ABILITYTAO_ACM/////////////////////////////





            int main()
            {

                Pre_in_to_pos test;
                
            string pre;
                
            string in;
                
            while(cin>>pre>>in)
                
            {
                    test.inputpre(pre);
                    test.inputin(
            in);
                    test.trans();
                    test.output();
                    cout
            <<endl;
                }

                
            return 0;
            }

            posted on 2009-05-24 01:41 abilitytao 閱讀(330) 評論(0)  編輯 收藏 引用

            久久久久国产亚洲AV麻豆| 伊人久久大香线蕉综合热线| 久久棈精品久久久久久噜噜| 精品国产乱码久久久久久呢| 久久久免费精品re6| 精品久久久久久国产免费了| 久久99久国产麻精品66| 久久成人精品视频| 久久久久久久波多野结衣高潮| 欧美激情精品久久久久| 中文字幕无码免费久久| 国产免费久久精品99久久| 99久久香蕉国产线看观香| 日本免费久久久久久久网站| 伊人久久大香线蕉AV一区二区| 99久久超碰中文字幕伊人| 国内精品伊人久久久影院| 天天久久狠狠色综合| 77777亚洲午夜久久多喷| 思思久久99热免费精品6| 久久婷婷国产麻豆91天堂| 久久人人妻人人爽人人爽| 久久综合色区| 精品久久久久中文字| 999久久久免费精品国产| 丁香色欲久久久久久综合网| 亚洲国产日韩欧美综合久久| 精品国产综合区久久久久久| 免费观看成人久久网免费观看| 色偷偷偷久久伊人大杳蕉| 亚洲午夜久久久影院| 国产A级毛片久久久精品毛片| 久久久精品人妻一区二区三区蜜桃 | 久久综合九色综合97_久久久| 久久夜色精品国产噜噜亚洲AV| 模特私拍国产精品久久| 日韩电影久久久被窝网| 久久最新免费视频| 亚洲国产香蕉人人爽成AV片久久 | 亚洲熟妇无码另类久久久| 久久久久国产精品嫩草影院|