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

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

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

    weidagang2046的專欄

    物格而后知致
    隨筆 - 8, 文章 - 409, 評(píng)論 - 101, 引用 - 0
    數(shù)據(jù)加載中……

    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) 評(píng)論(0)  編輯  收藏 所屬分類: Others

    主站蜘蛛池模板: 美女无遮挡免费视频网站| 一级一看免费完整版毛片| 免费大黄网站在线观| 成人性生交大片免费看好| 亚洲一区免费在线观看| 免费一级毛片不卡不收费| 91高清免费国产自产拍2021| 国产精品手机在线亚洲| 久久精品国产亚洲夜色AV网站| 在线精品免费视频无码的| a级毛片高清免费视频就| 亚洲精品乱码久久久久久V| 亚洲国产精品无码久久久不卡| 性盈盈影院免费视频观看在线一区| 男女一进一出抽搐免费视频 | 久操视频在线免费观看| 亚洲国产激情在线一区| 亚洲欧洲日产国码无码网站 | 色天使亚洲综合在线观看| 性xxxxx大片免费视频| 日本人的色道www免费一区| 成人无码WWW免费视频| 亚洲Aⅴ在线无码播放毛片一线天 亚洲avav天堂av在线网毛片 | 亚洲AV日韩AV高潮无码专区| 国产成人免费网站在线观看 | 国产偷v国产偷v亚洲高清| 国产又大又粗又硬又长免费| 97视频免费在线| 久久国产乱子免费精品| 一级特级女人18毛片免费视频| 亚洲伊人久久大香线蕉AV| 亚洲国产一区在线| 亚洲中文字幕日产乱码高清app| 日本高清免费网站| 久久不见久久见中文字幕免费| 一级毛片免费观看不卡视频| 中文字幕成人免费高清在线 | 国产一区二区三区在线免费观看 | 亚洲综合另类小说色区| 免费又黄又爽又猛的毛片| 美女被免费视频网站a国产|