亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
国产精品国产馆在线真实露脸 | 欧美性生活影院| 国产精品亚洲а∨天堂免在线| 欧美网站大全在线观看| 久久综合狠狠综合| 亚洲综合999| 色先锋资源久久综合| 午夜精品一区二区三区免费视频 | 日本午夜一区二区| 日韩欧美高清一区| 99久久综合国产精品| 依依成人精品视频| 欧美日本韩国一区| 国产麻豆一精品一av一免费 | 国产亚洲成年网址在线观看| 成人免费看黄yyy456| 日韩精品亚洲一区二区三区免费| 精品噜噜噜噜久久久久久久久试看 | 欧美色网一区二区| 国产69精品久久99不卡| 奇米色777欧美一区二区| 久久久www免费人成精品| a美女胸又www黄视频久久| 青草国产精品久久久久久| 中文字幕一区二区三区蜜月 | 一区二区在线电影| 久久久久国产精品厨房| 欧美一区二区三区视频免费播放| 国内精品国产成人| 麻豆成人免费电影| 日韩电影在线免费看| 亚洲综合999| 亚洲一区二区三区四区在线观看| 国产精品人妖ts系列视频| 亚洲精品在线免费播放| 91精品一区二区三区久久久久久| 91九色最新地址| 色综合久久99| 欧美人狂配大交3d怪物一区| 欧美性色黄大片| 成人精品国产免费网站| 日韩在线a电影| 国产精品一区二区免费不卡| 国产成人在线视频网址| 91农村精品一区二区在线| 日本韩国欧美一区| 欧美成人在线直播| 最近日韩中文字幕| 久久99国产精品久久| 岛国精品在线播放| 欧美一级黄色片| 亚洲欧美综合在线精品| 日韩在线一区二区三区| 菠萝蜜视频在线观看一区| 欧美人牲a欧美精品| 亚洲婷婷综合色高清在线| 精品亚洲porn| 欧美在线你懂得| 久久精品日产第一区二区三区高清版| 中文字幕一区二区在线观看| 麻豆成人久久精品二区三区小说| 成人av动漫在线| 国产成人在线看| 热久久一区二区| 麻豆国产精品777777在线| 日韩电影在线免费看| 免费观看30秒视频久久| 亚欧色一区w666天堂| 国产综合久久久久久久久久久久| 欧美日本免费一区二区三区| 国产嫩草影院久久久久| 日韩精品一二三四| 91丝袜高跟美女视频| 久久久久久免费| 青青草伊人久久| 欧美色老头old∨ideo| 久久久久久免费网| 成人永久免费视频| 亚洲三级免费观看| 欧美丰满一区二区免费视频| 秋霞电影网一区二区| 日韩欧美精品在线视频| 青青草视频一区| 久久久亚洲精品一区二区三区 | 国产欧美视频一区二区| 97久久人人超碰| 亚洲人成网站影音先锋播放| 在线视频中文字幕一区二区| 亚洲综合精品自拍| 欧美一级夜夜爽| 丰满白嫩尤物一区二区| 一区二区三区高清在线| 欧美日韩精品福利| 国产精品自拍三区| 亚洲男同性视频| 欧美色综合网站| 成人av在线一区二区| 一区二区三区四区五区视频在线观看| 欧美一级片在线观看| 欧美午夜电影在线播放| 激情久久五月天| 亚洲福利视频三区| 国产欧美一区二区三区在线老狼| 91在线精品一区二区三区| 婷婷激情综合网| 最新高清无码专区| 久久尤物电影视频在线观看| 欧美精品精品一区| 欧美亚洲国产bt| 欧美精品色一区二区三区| 不卡一区二区三区四区| 国产高清在线精品| 男女性色大片免费观看一区二区| 国产精品久久久久aaaa樱花| 欧美电影在线免费观看| 色网综合在线观看| 欧美日韩一区三区| 日韩欧美精品在线| 久久精品亚洲精品国产欧美kt∨| 欧美变态口味重另类| 久久免费视频色| 久久精品一区二区三区不卡| 欧美不卡一区二区三区| 在线电影国产精品| 欧美久久久久久久久久| 欧美一级高清片| 国产精品初高中害羞小美女文| 久久综合999| 一区二区在线免费观看| 奇米影视7777精品一区二区| 精品无人区卡一卡二卡三乱码免费卡 | 欧美精品一区二区三区在线 | 日韩精品一区二区三区中文精品| 精品国产sm最大网站免费看| 国产精品久久久久影院| 亚洲与欧洲av电影| 福利一区二区在线观看| 在线亚洲一区观看| 国产午夜精品久久| 亚洲成在人线免费| 成人综合日日夜夜| 精品国产一区二区三区四区四| 亚洲精选一二三| 福利一区二区在线观看| 欧美一卡2卡三卡4卡5免费| 中文字幕一区二区三区色视频 | 欧美va亚洲va| 亚洲国产一区视频| 国产一区不卡精品| 欧美日韩一区二区欧美激情| 日韩一区有码在线| 国产大陆亚洲精品国产| 久久综合色播五月| 日本不卡一区二区| 在线观看亚洲专区| 亚洲欧洲av在线| 99re成人在线| 中文字幕 久热精品 视频在线| 毛片av一区二区| 欧美成人一区二区三区片免费| 日韩二区三区四区| 欧美日韩亚州综合| 美女一区二区视频| 久久久精品免费网站| 国产经典欧美精品| 亚洲美女免费视频| 欧美主播一区二区三区美女| 亚洲人成影院在线观看| 色婷婷精品大视频在线蜜桃视频 | 99国内精品久久| 蜜臀久久久99精品久久久久久| 日韩视频免费观看高清完整版| 久久99久久99小草精品免视看| 日韩免费电影网站| 国产69精品久久777的优势| 一区免费观看视频| 5858s免费视频成人| 国产麻豆精品theporn| 亚洲精品五月天| 久久视频一区二区| 欧美日韩视频在线一区二区| 久久国产综合精品| 国产日韩欧美a| 欧美日韩黄色一区二区| 成人开心网精品视频| 偷窥少妇高潮呻吟av久久免费| 国产亚洲一本大道中文在线| 884aa四虎影成人精品一区| 国产精品88av| 国产一区不卡在线| 亚洲国产一区二区在线播放| 国产精品麻豆视频| 欧美精品一区二区久久久| 制服丝袜在线91| 69av一区二区三区| 欧美日精品一区视频| 91国内精品野花午夜精品| 成人av集中营| 91片在线免费观看| 欧美在线观看视频在线|