algorithm-study-of-GN / problem-of-coding-interview

코딩 인터뷰 완전 분석의 문제 해결 저장소입니다.
MIT License
16 stars 4 forks source link

Lowest Common Ancestor in BST #14

Open ybkim opened 8 years ago

ybkim commented 8 years ago
namespace BST {
    template<typename T>
    struct Node {
        T      data;
        Node * left;
        Node * right;

        explicit Node (
            const T & data
        )   : data(data)
            , left(nullptr)
            , right(nullptr)
        {}
    }

    template<typename T>
    Node<T> * LowestCommonAncestor (
        Node<T> * root,
        Node<T> * p,
        Node<T> * q
    ) {
        /* Enter your code here */

        return nullptr;
    }
};