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

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

?? binarysearchtree.h

?? C++編成數據結構與程序設計方法 D.S.Malk編著
?? H
字號:
//Header File Binary Search Tree

#ifndef H_binarySearchTree
#define H_binarySearchTree
#include <iostream>
#include "binaryTree.h"

using namespace std;

template <class elemType>
class bSearchTreeType: public binaryTreeType<elemType>
{
public:
    bool search(const elemType& searchItem) const;
      //Function to determine if searchItem is in the binary 
      //search tree.
      //Postcondition: Returns true if searchItem is found in 
      //               the binary search tree; otherwise, 
      //               returns false.

    void insert(const elemType& insertItem);
      //Function to insert insertItem in the binary search tree.
      //Postcondition: If there is no node in the binary search
      //               tree that has the same info as 
      //               insertItem, a node with the info 
      //               insertItem is created and inserted in the
      //               binary search tree.

    void deleteNode(const elemType& deleteItem);
      //Function to delete deleteItem from the binary search tree 
      //Postcondition: If a node with the same info as deleteItem
      //               is found, it is deleted from the binary 
      //               search tree.
      //               If the binary tree is empty or deleteItem
      //               is not in the binary tree, an appropriate
      //               message is ptinted.

private:
    void deleteFromTree(nodeType<elemType>* &p);
      //Function to delete the node to which p points is 
      //deleted from the binary search tree.
      //Postcondition: The node to which p points is deleted
      //               from the binary search tree.
};


template <class elemType>
bool bSearchTreeType<elemType>::search
                    (const elemType& searchItem) const
{
    nodeType<elemType> *current;
    bool found = false;

    if (root == NULL)
        cout << "Cannot search an empty tree." << endl;
    else
    { 
       current = root;

       while (current != NULL && !found)
        {
            if (current->info == searchItem)
                found = true;
            else if (current->info > searchItem)
                current = current->lLink;
            else
                current = current->rLink;
        }//end while
    }//end else

    return found;
}//end search

template <class elemType>
void bSearchTreeType<elemType>::insert
                 (const elemType& insertItem)
{
    nodeType<elemType> *current; //pointer to traverse the tree
    nodeType<elemType> *trailCurrent; //pointer behind current
    nodeType<elemType> *newNode;  //pointer to create the node

    newNode = new nodeType<elemType>;
    newNode->info = insertItem;
    newNode->lLink = NULL;
    newNode->rLink = NULL;

    if (root == NULL)
        root = newNode;
    else
    {
        current = root;
 
        while (current != NULL)
        {
            trailCurrent = current;

            if (current->info == insertItem)
            {
                cout << "The item to be inserted is already ";
                cout << "in the tree -- duplicates are not "
                     << "allowed." << endl;
                return;
            }
            else if (current->info > insertItem)
                current = current->lLink;
            else
                current = current->rLink;
        }//end while

        if (trailCurrent->info > insertItem)
            trailCurrent->lLink = newNode;
        else
            trailCurrent->rLink = newNode;
    }
}//end insert

template <class elemType>
void bSearchTreeType<elemType>::deleteNode
                                (const elemType& deleteItem)
{
    nodeType<elemType> *current; //pointer to traverse the tree
    nodeType<elemType> *trailCurrent; //pointer behind current
    bool found = false;

    if (root == NULL)
        cout << "Cannot delete from an empty tree." 
             << endl;
    else
    {
        current = root;
        trailCurrent = root;

        while (current != NULL && !found)
        {
            if (current->info == deleteItem)
                found = true;
            else
            {
                trailCurrent = current;

                if (current->info > deleteItem)
                    current = current->lLink;
                else
                    current = current->rLink;
            }
        }//end while

        if (current == NULL)
            cout << "The item to be deleted is not in the tree." 
                 << endl;
        else if (found)
        {
            if (current == root)
                deleteFromTree(root);
            else if (trailCurrent->info > deleteItem)
                deleteFromTree(trailCurrent->lLink);
            else
                deleteFromTree(trailCurrent->rLink);
        }
        else
            cout << "The item to be deleted is not in the tree."
                 << endl;
    }
} //end deleteNode

template <class elemType>
void bSearchTreeType<elemType>::deleteFromTree
                                 (nodeType<elemType>* &p)
{
    nodeType<elemType> *current; //pointer to traverse the tree
    nodeType<elemType> *trailCurrent;  //pointer behind current
    nodeType<elemType> *temp;      //pointer to delete the node

    if (p == NULL)
        cout << "Error: The node to be deleted is NULL."
             << endl;
    else if (p->lLink == NULL && p->rLink == NULL)
    {
        temp = p;
        p = NULL;
        delete temp;
    }
    else if (p->lLink == NULL)
    {
        temp = p;
        p = temp->rLink;
        delete temp;
    }
    else if (p->rLink == NULL)
    {
        temp = p;
        p = temp->lLink;
        delete temp;
    }
    else
    {
        current = p->lLink;
        trailCurrent = NULL;

        while (current->rLink != NULL)
        {
            trailCurrent = current;
            current = current->rLink;
        }//end while

        p->info = current->info;

        if (trailCurrent == NULL) //current did not move; 
                               //current == p->lLink; adjust p
            p->lLink = current->lLink;
        else
            trailCurrent->rLink = current->lLink;
 
        delete current;
    }//end else
} //end deleteFromTree

#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91成人网在线| 亚洲精品一区二区三区蜜桃下载| 91免费国产视频网站| 成熟亚洲日本毛茸茸凸凹| 粉嫩嫩av羞羞动漫久久久| 国产精品羞羞答答xxdd| 成人精品国产一区二区4080| 国产成人午夜片在线观看高清观看| 国产精品伊人色| gogogo免费视频观看亚洲一| 不卡的av在线播放| 在线视频中文字幕一区二区| 欧美最新大片在线看| 欧美高清激情brazzers| 欧美一区二区视频免费观看| 2024国产精品| 国产精品国产三级国产有无不卡| 国产精品欧美综合在线| 亚洲免费在线播放| 水野朝阳av一区二区三区| 久久精品国产亚洲a| 成人午夜电影久久影院| 91香蕉国产在线观看软件| 欧美日韩综合一区| 精品乱人伦小说| 欧美—级在线免费片| 一区二区三国产精华液| 丝袜美腿亚洲一区二区图片| 国产一区二区三区四区五区美女| www.亚洲在线| 884aa四虎影成人精品一区| 精品久久久久久最新网址| 国产精品成人免费在线| 丝袜亚洲另类欧美| 福利一区在线观看| 欧美又粗又大又爽| 久久免费视频一区| 亚洲与欧洲av电影| 国内精品第一页| 色综合久久九月婷婷色综合| 欧美一级高清大全免费观看| 国产精品高潮呻吟| 美女一区二区视频| 93久久精品日日躁夜夜躁欧美| 制服视频三区第一页精品| 99久久精品免费看国产| 国产白丝精品91爽爽久久| 欧美亚洲综合在线| 久久只精品国产| 一区二区三区在线免费播放| 蜜桃视频在线一区| www.日韩av| 精品国产一区二区亚洲人成毛片| 日韩美女视频19| 国产一区二区三区久久久| 91成人在线精品| 久久久久久黄色| 亚洲v精品v日韩v欧美v专区| 懂色av一区二区在线播放| 日韩一区二区三区电影 | 中文在线免费一区三区高中清不卡| 一区二区三区不卡在线观看| 国产**成人网毛片九色| 欧美一区二区久久久| 中文字幕一区二区三区在线播放| 美脚の诱脚舐め脚责91 | 91色.com| 国产女主播一区| 麻豆freexxxx性91精品| 欧美影视一区二区三区| 国产精品理论在线观看| 黑人精品欧美一区二区蜜桃| 欧美高清激情brazzers| 一区二区三区日韩精品视频| 高清不卡在线观看av| 日韩欧美国产wwwww| 亚洲成人自拍偷拍| 在线中文字幕一区| 国产精品区一区二区三| 国产精一区二区三区| 欧美大黄免费观看| 亚洲v精品v日韩v欧美v专区| 日本久久一区二区| 国产精品成人免费精品自在线观看| 国产一区二区三区免费看| 日韩三级在线观看| 日韩av在线播放中文字幕| 精品视频一区二区不卡| 一区二区三区日韩欧美| 色一情一乱一乱一91av| 亚洲免费观看高清完整版在线 | 国产亚洲欧洲一区高清在线观看| 免费看日韩a级影片| 欧美一区日韩一区| 视频一区二区三区入口| 欧美日韩午夜精品| 五月婷婷综合网| 在线播放91灌醉迷j高跟美女| 午夜精品在线看| 欧美久久久久中文字幕| 日韩有码一区二区三区| 欧美老肥妇做.爰bbww| 日韩国产欧美在线播放| 在线综合+亚洲+欧美中文字幕| 日韩精品乱码免费| 日韩欧美在线网站| 激情综合一区二区三区| 久久嫩草精品久久久精品| 国产成人午夜高潮毛片| 国产日韩亚洲欧美综合| 菠萝蜜视频在线观看一区| 自拍偷拍亚洲激情| 欧美综合亚洲图片综合区| 五月天久久比比资源色| 日韩一区二区三区免费观看| 国产精品拍天天在线| 日本怡春院一区二区| 欧美一级黄色录像| 精品一区二区免费在线观看| 国产亚洲精品超碰| 99精品视频在线播放观看| 一区二区三区精品视频| 欧美日本国产视频| 免费在线观看一区| 久久久.com| 色婷婷综合视频在线观看| 性久久久久久久久| 久久综合av免费| 91论坛在线播放| 日韩成人精品在线观看| 国产清纯在线一区二区www| 一本色道**综合亚洲精品蜜桃冫| 午夜精品在线视频一区| 久久久久久久综合色一本| 99久久久免费精品国产一区二区 | 99re这里只有精品首页| 亚洲一区免费观看| 日韩美女在线视频| bt欧美亚洲午夜电影天堂| 亚洲国产视频直播| 亚洲精品一区二区三区影院| 99精品热视频| 麻豆一区二区99久久久久| 国产精品国产自产拍在线| 欧美日韩国产首页在线观看| 国产一区二区三区观看| 一区二区三区中文字幕| 精品蜜桃在线看| 一本色道综合亚洲| 久久超碰97人人做人人爱| 亚洲欧洲国产专区| 91精品国产手机| 91免费看`日韩一区二区| 久久精品国产一区二区三| 亚洲精品视频在线看| 久久综合九色综合97婷婷| 欧美在线啊v一区| 国产成人aaa| 奇米综合一区二区三区精品视频| 国产精品乱人伦中文| 制服丝袜日韩国产| 色综合视频一区二区三区高清| 美女视频黄 久久| 亚洲一区二区三区在线| 国产欧美一区二区精品秋霞影院 | 欧美日韩国产一级| av日韩在线网站| 午夜精品福利一区二区三区av | 久久精品在线免费观看| 欧美视频在线一区二区三区| 粉嫩在线一区二区三区视频| 蜜臀va亚洲va欧美va天堂| 亚洲精品国久久99热| 久久精品水蜜桃av综合天堂| 6080日韩午夜伦伦午夜伦| 色999日韩国产欧美一区二区| 国产成人免费视频网站 | 日本少妇一区二区| 亚洲精品日日夜夜| 中文子幕无线码一区tr| 日韩免费成人网| 欧美日韩另类一区| 91丨九色丨黑人外教| 国产成人精品免费在线| 精品一区二区三区免费播放| 天天综合日日夜夜精品| 亚洲精品自拍动漫在线| 国产精品麻豆视频| 久久精品视频在线免费观看| 欧美一级生活片| 91精品国产综合久久福利软件| 在线这里只有精品| 91久久精品日日躁夜夜躁欧美| 成av人片一区二区| www.欧美精品一二区| 国产精品91一区二区| 国产精品一级黄| 国产精品综合网| 国产高清无密码一区二区三区| 国产麻豆视频一区|