亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? binarytree.h

?? 游戲開發數據結構-Data.Structures.for.Game.Programmers
?? H
字號:
// ============================================================================
// Data Structures For Game Programmers
// Ron Penton
// BinaryTree.h
// This is the Binary Tree class
// ============================================================================
#ifndef BINARYTREE_H
#define BINARYTREE_H


// -------------------------------------------------------
// Name:        BinaryTree
// -------------------------------------------------------
template<class DataType>
class BinaryTree
{
public:
    // typedef the tree class into "Node" to make it 
    // easier to work with.
    typedef BinaryTree<DataType> Node;

// ----------------------------------------------------------------
//  Name:           m_data
//  Description:    This is the data in the node
// ----------------------------------------------------------------
    DataType m_data;

// ----------------------------------------------------------------
//  Name:           m_parent
//  Description:    This is a pointer to the parent node.
//                  If 0, then it is the parent node.
// ----------------------------------------------------------------
    Node* m_parent;

// ----------------------------------------------------------------
//  Name:           m_left, m_right
//  Description:    These are the children of the node.
// ----------------------------------------------------------------
    Node* m_left;
    Node* m_right;


// ----------------------------------------------------------------
//  Name:           BinaryTree
//  Description:    Constructor; creates an empty node
//  Arguments:      None.
//  Return Value:   None.
// ----------------------------------------------------------------
    BinaryTree()
    {
        m_parent = 0;
        m_left = 0;
        m_right = 0;
    }


// ----------------------------------------------------------------
//  Name:           BinaryTree
//  Description:    Data Constructor; creates a node with data
//  Arguments:      p_data - the data to store in the node
//  Return Value:   None.
// ----------------------------------------------------------------
    BinaryTree( DataType p_data )
    {
        m_parent = 0;
        m_left = 0;
        m_right = 0;
        m_data = p_data;
    }

// ----------------------------------------------------------------
//  Name:           ~BinaryTree
//  Description:    Destructor; recursively destroys the tree.
//  Arguments:      None.
//  Return Value:   None.
// ----------------------------------------------------------------
    ~BinaryTree()
    {
        Destroy();
    }

// ----------------------------------------------------------------
//  Name:           Destroy
//  Description:    This deletes the left and right children.
//  Arguments:      None.
//  Return Value:   None.
// ----------------------------------------------------------------
    void Destroy()
    {
        // if the left child exists, delete it.
        if( m_left )
            delete m_left;
        m_left = 0;

        // if the right child exists, delete it.
        if( m_right )
            delete m_right;
        m_right = 0;
    }


// ----------------------------------------------------------------
//  Name:           Count
//  Description:    Constructor; creates an empty node
//  Arguments:      None.
//  Return Value:   The number of nodes in the tree
// ----------------------------------------------------------------
    int Count()
    {
        // the count is set to 1, counting this node.
        int c = 1;

        // recursively add the counts of each child.
        if( m_left )
            c += m_left->Count();
        if( m_right )
            c += m_right->Count();

        // return the count.
        return c;
    }

};



// ----------------------------------------------------------------
//  Name:           Preorder
//  Description:    performs a preorder traversal on a tree
//  Arguments:      p_node - the node to start processing at.
//                  p_process - a function pointer to the process
//                              function
//  Return Value:   None.
// ----------------------------------------------------------------
template <class DataType>
void Preorder( BinaryTree<DataType>* p_node, 
               void (*p_process)(BinaryTree<DataType>*) )
{
    // if the node exists
    if( p_node )
    {
        // process the current node
        p_process( p_node );

        // process the left child
        if( p_node->m_left )
            Preorder( p_node->m_left );

        // process the right node
        if( p_node->m_right )
            Preorder( p_node->m_right );
    }
}


// ----------------------------------------------------------------
//  Name:           Inorder
//  Description:    performs an inorder traversal on a tree
//  Arguments:      p_node - the node to start processing at.
//                  p_process - a function pointer to the process
//                              function
//  Return Value:   None.
// ----------------------------------------------------------------
template <class DataType>
void Inorder( BinaryTree<DataType>* p_node, 
              void (*p_process)(BinaryTree<DataType>*) )
{
    // if the node exists
    if( p_node )
    {
        // process the left node
        if( p_node->m_left )
            Preorder( p_node->m_left );

        // process the current node
        p_process( p_node );

        // process the right node
        if( p_node->m_right )
            Preorder( p_node->m_right );
    }
}


// ----------------------------------------------------------------
//  Name:           Postorder
//  Description:    performs a postorder traversal on a tree
//  Arguments:      p_node - the node to start processing at.
//                  p_process - a function pointer to the process
//                              function
//  Return Value:   None.
// ----------------------------------------------------------------
template <class DataType>
void Postorder( BinaryTree<DataType>* p_node, 
                void (*p_process)(BinaryTree<DataType>*) )
{
    // if the node exists
    if( p_node )
    {
        // process the left node
        if( p_node->m_left )
            Preorder( p_node->m_left );

        // process the right node
        if( p_node->m_right )
            Preorder( p_node->m_right );

        // process the current node
        p_process( p_node );
    }
}



// ----------------------------------------------------------------
//  Name:           GetDepth
//  Description:    Recursively calculates the depth of a tree.
//  Arguments:      p_node - the root of the tree
//  Return Value:   The depth; 0 is the lowest.
// ----------------------------------------------------------------
template<class DataType>
int GetDepth( BinaryTree<DataType>* p_tree )
{
    // start off with -1 for the depth of each child
    int left = -1;
    int right = -1;

    // calculate the depth of the left child
    if( p_tree->m_left != 0 )
        left = GetDepth( p_tree->m_left );

    // calculate the depth of the right child
    if( p_tree->m_right != 0 )
        right = GetDepth( p_tree->m_right );

    // take the larger of the two depths, add one, and return.
    return ( left > right ? left : right ) + 1;
}

#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲精品在线观看网站| 99综合电影在线视频| 欧美狂野另类xxxxoooo| 亚洲乱码国产乱码精品精小说| 国产在线精品不卡| 精品福利一区二区三区| 久久草av在线| 这里只有精品电影| 日本视频中文字幕一区二区三区| 欧美日韩的一区二区| 一区二区欧美视频| 色8久久精品久久久久久蜜| 亚洲欧美二区三区| 91久久精品国产91性色tv| 亚洲精品中文在线影院| 色欲综合视频天天天| 综合激情网...| 91福利社在线观看| 午夜欧美一区二区三区在线播放| 欧美高清视频一二三区| 蜜臀av一区二区| wwwwww.欧美系列| 国产在线播放一区三区四| 久久久久九九视频| 成人高清视频在线观看| 亚洲欧美日韩久久| 欧美日本一道本| 久久精品国产亚洲aⅴ| 日韩免费高清电影| 国产成人午夜99999| 亚洲美女在线一区| 欧美一区三区二区| 国产精品1区二区.| 亚洲综合无码一区二区| 欧美一级欧美三级在线观看| 狠狠久久亚洲欧美| 亚洲裸体xxx| 99精品在线观看视频| 亚洲成人av在线电影| 欧美一区二区三区在线观看| 极品少妇xxxx精品少妇偷拍| 国产精品美女久久久久久久| 欧美无乱码久久久免费午夜一区| 美女视频免费一区| 亚洲色图欧洲色图婷婷| 日韩视频国产视频| 99久精品国产| 久久er精品视频| 亚洲va欧美va人人爽午夜| 国产亚洲欧美色| 精品蜜桃在线看| 91精品免费在线观看| 在线观看一区不卡| 99久久精品99国产精品| 国产99精品国产| 另类中文字幕网| 日韩高清不卡在线| 亚洲bt欧美bt精品777| 亚洲欧美激情一区二区| 国产精品国产成人国产三级| 久久久久成人黄色影片| 欧美成人a∨高清免费观看| 欧美日本国产一区| 欧美午夜一区二区三区免费大片| proumb性欧美在线观看| 成人妖精视频yjsp地址| 国产91在线观看丝袜| 国产福利一区二区三区| 激情图区综合网| 精品一区中文字幕| 久久99国产精品成人| 日韩av不卡一区二区| 亚洲成人免费av| 日韩精品欧美精品| 日本成人在线看| 视频一区二区国产| 日韩高清欧美激情| 麻豆专区一区二区三区四区五区| 视频一区在线视频| 五月综合激情网| 日韩精品午夜视频| 激情欧美一区二区| 国产一区二区精品久久99| 狠狠色狠狠色综合| 国产精品1区2区3区在线观看| 国产一区二区成人久久免费影院| 精品一区精品二区高清| 国产成人精品免费看| 国产成人免费在线观看不卡| av电影天堂一区二区在线| 91丨九色丨蝌蚪丨老版| 日本国产一区二区| 这里只有精品视频在线观看| 日韩精品一区二区三区中文不卡 | 婷婷综合五月天| 美日韩一区二区三区| 国产一区 二区| 不卡的电影网站| 99精品视频在线播放观看| jlzzjlzz国产精品久久| 在线这里只有精品| 欧美一级生活片| 中国av一区二区三区| 亚洲精品成人悠悠色影视| 婷婷六月综合亚洲| 国产精品一区三区| 色综合天天视频在线观看| 制服丝袜亚洲播放| 欧美激情在线一区二区三区| 一区二区三区精品视频在线| 青青草成人在线观看| 国产精品123区| 91国偷自产一区二区三区成为亚洲经典 | 成人av电影在线网| 在线免费观看日本欧美| 日韩欧美一级在线播放| 国产精品美女一区二区三区| 性欧美疯狂xxxxbbbb| 国产激情91久久精品导航| 在线观看日韩一区| 2019国产精品| 亚洲一区中文日韩| 国产精品小仙女| 欧美日本一区二区三区| 国产精品午夜电影| 麻豆91在线看| 91福利精品视频| 国产日韩欧美高清| 男人的天堂亚洲一区| 色综合色狠狠天天综合色| 久久先锋资源网| 亚洲综合激情小说| www.欧美精品一二区| 日韩精品中午字幕| 亚洲成人av免费| 99久久精品国产毛片| 26uuuu精品一区二区| 日韩黄色免费网站| 色综合久久久久久久久久久| 久久久精品免费免费| 日韩不卡免费视频| 欧美图片一区二区三区| 亚洲视频香蕉人妖| 成人免费视频网站在线观看| 精品伦理精品一区| 日韩激情视频在线观看| 欧美在线观看你懂的| 综合欧美一区二区三区| 国产99一区视频免费| 久久综合久久综合久久| 全部av―极品视觉盛宴亚洲| 欧美另类videos死尸| 一区二区三区在线视频免费观看 | 91一区二区三区在线观看| 久久久久久久久久久99999| 美腿丝袜亚洲色图| 日韩一区二区三区在线| 日韩电影免费一区| 欧美肥妇毛茸茸| 三级影片在线观看欧美日韩一区二区| 色婷婷久久久综合中文字幕| 中文字幕日韩一区| 成人国产视频在线观看| 中文字幕第一页久久| 国产 日韩 欧美大片| 国产精品网站导航| 成人黄色在线网站| 国产精品高清亚洲| 色综合中文综合网| 国产自产高清不卡| 精品卡一卡二卡三卡四在线| 人人爽香蕉精品| 精品免费国产一区二区三区四区| 久久精品国产第一区二区三区| 日韩一区二区在线观看| 裸体一区二区三区| 2023国产精品| 成人一区二区三区视频在线观看| 国产精品卡一卡二| 色一区在线观看| 亚洲无线码一区二区三区| 欧美日韩精品一区二区三区蜜桃| 无码av中文一区二区三区桃花岛| 欧美一区二区黄| 国产精品正在播放| 自拍视频在线观看一区二区| 91搞黄在线观看| 蜜乳av一区二区| 国产亚洲一区字幕| 91在线视频官网| 天天综合天天综合色| 欧美一区二区高清| 成人免费高清在线| 亚洲一区二区三区中文字幕| 日韩一区二区免费在线电影 | 国产精品高潮久久久久无| 在线免费观看日本一区| 裸体健美xxxx欧美裸体表演| 中文乱码免费一区二区| 欧美无乱码久久久免费午夜一区|