<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    weidagang2046的專欄

    物格而后知致
    隨筆 - 8, 文章 - 409, 評論 - 101, 引用 - 0
    數據加載中……

    Find Common Ancestor

    Find Common Ancestor
    Problem: find the common ancestor of two nodes in a tree

    Given a "tree" pointer pointing to the root node of a tree and the other two pointers to two nodes in the tree. You are expected to write a C++ subroutine to find the common ancestor of the two nodes. In any unexpected condition, your code should return null pointer and avoid crashing.

    For example, if the tree is like below, B is the common ancestor of E and G; A is the common ancestor of H and F; D is the common ancestor of D and G.

     
    gailya 20:30:17
    You are allowed to use recursion but as few as possible. You are NOT allowed to use STL. Please follow the type definitions shown below:

    //tree node type
    typedef struct _Node
    ...{
        char value;
        struct _Node* left;
        struct _Node* right;
    }Node;

    class CommonNodeFinder
    ...{
        //add any auxiliary code here as you wish.
    public:
        inline Node* FindCommonAncestor(Node* tree, Node* node_1, Node* node_2)
        ...{
            //your code here.
        }
    }

    posted on 2005-10-27 21:06 weidagang2046 閱讀(298) 評論(0)  編輯  收藏 所屬分類: Others

    主站蜘蛛池模板: 国产在线观a免费观看| 两个人看的www视频免费完整版| 69视频在线观看免费| 亚洲av无码乱码国产精品| a级毛片视频免费观看| 亚洲Av熟妇高潮30p| 99re6在线精品视频免费播放| 97亚洲熟妇自偷自拍另类图片| 午夜精品射精入后重之免费观看 | www.亚洲一区| 精品多毛少妇人妻AV免费久久| 在线观看亚洲成人| 久久久久免费精品国产| 亚洲色图.com| 毛片免费观看网址| 美国免费高清一级毛片| 国产亚洲精品AA片在线观看不加载 | 在线观看免费亚洲| AV在线亚洲男人的天堂 | 无遮免费网站在线入口| 亚洲精品二三区伊人久久| 日本二区免费一片黄2019| 免费毛片毛片网址| 亚洲国产精品无码专区影院| 最近中文字幕免费2019| 亚洲熟妇成人精品一区| 亚洲精品成人a在线观看| 久久成人免费大片| 亚洲乱码无人区卡1卡2卡3| 亚洲无码视频在线| 猫咪免费人成网站在线观看| 亚洲av无码专区在线观看下载| 国内精品99亚洲免费高清| 中文字幕在线免费观看| 亚洲第一成年网站视频| 亚洲伊人久久精品影院| 在线视频观看免费视频18| 日韩精品无码永久免费网站| 亚洲网站视频在线观看| 在线a亚洲v天堂网2018| 最近中文字幕大全中文字幕免费|