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

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

?? linkedlist.h

?? C++編成數據結構與程序設計方法 D.S.Malk編著
?? H
字號:
#ifndef H_LinkedListType
#define H_LinkedListType

#include <iostream>
#include <cassert>

using namespace std;

//Definition of the node

template <class Type>
struct nodeType
{
	Type info;
	nodeType<Type> *link;
};

template <class Type>
class linkedListIterator
{
public:
   linkedListIterator();
     //Default constructor
     //Postcondition: current = NULL;

   linkedListIterator(nodeType<Type> *ptr);
     //Constructor with a parameter.
     //Postcondition: current = ptr;

   Type operator*();
     //Function to overload the dereferencing operator *.
     //Postcondition: Returns the info contained in the node.

   linkedListIterator<Type> operator++();    
     //Overload the pre-increment operator.
     //Postcondition: The iterator is advanced to the next 
     //               node.

   bool operator==(const linkedListIterator<Type>& right) const; 
     //Overload the equality operator.
     //Postcondition: Returns true if this iterator is equal to 
     //               the iterator specified by right, 
     //               otherwise it returns the value false.

   bool operator!=(const linkedListIterator<Type>& right) const; 
     //Overload the not equal to operator.
     //Postcondition: Returns true if this iterator is not  
     //               equal to the iterator specified by  
     //               right; otherwise it returns the value 
     //               false.

private:
   nodeType<Type> *current; //pointer to point to the current 
                            //node in the linked list
};

template <class Type>
linkedListIterator<Type>::linkedListIterator()
{
    current = NULL;
}

template <class Type>
linkedListIterator<Type>::
                  linkedListIterator(nodeType<Type> *ptr)
{
    current = ptr;
}

template <class Type>
Type linkedListIterator<Type>::operator*()
{
    return current->info;
}

template <class Type>
linkedListIterator<Type> linkedListIterator<Type>::operator++()   
{
    current = current->link;

    return *this;
}

template <class Type>
bool linkedListIterator<Type>::operator==
               (const linkedListIterator<Type>& right) const
{
    return (current == right.current);
}

template <class Type>
bool linkedListIterator<Type>::operator!=
                 (const linkedListIterator<Type>& right) const
{    return (current != right.current);
}


//*****************  class linkedListType   ****************

template <class Type>
class linkedListType
{
public:
    const linkedListType<Type>& operator=
                         (const linkedListType<Type>&);  
      //Overload the assignment operator.

    void initializeList(); 
      //Initialize the list to an empty state.
      //Postcondition: first = NULL, last = NULL, count = 0;

    bool isEmptyList() const;
      //Function to determine whether the list is empty. 
      //Postcondition: Returns true if the list is empty,
      //               otherwise it returns false.

    void print() const;
      //Function to output the data contained in each node.
      //Postcondition: none

    int length() const;
      //Function to return the number of nodes in the list.
      //Postcondition: The value of count is returned.

    void destroyList();
      //Function to delete all the nodes from the list.
      //Postcondition: first = NULL, last = NULL, count = 0;

    Type front() const; 
      //Function to return the first element of the list.
      //Precondition: The list must exist and must not be 
      //              empty.
      //Postcondition: If the list is empty, the program
      //               terminates; otherwise, the first 
      //               element of the list is returned.

    Type back() const; 
      //Function to return the last element of the list.
      //Precondition: The list must exist and must not be 
      //              empty.
      //Postcondition: If the list is empty, the program
      //               terminates; otherwise, the last  
      //               element of the list is returned.

    virtual bool search(const Type& searchItem) const = 0;
      //Function to determine whether searchItem is in the list.
      //Postcondition: Returns true if searchItem is in the 
      //               list, otherwise the value false is 
      //               returned.

    virtual void insertFirst(const Type& newItem) = 0;
      //Function to insert newItem at the beginning of the list.
      //Postcondition: first points to the new list, newItem is
      //               inserted at the beginning of the list,
      //               last points to the last node in the list, 
      //               and count is incremented by 1.

    virtual void insertLast(const Type& newItem) = 0;
      //Function to insert newItem at the end of the list.
      //Postcondition: first points to the new list, newItem 
      //               is inserted at the end of the list,
      //               last points to the last node in the list,
      //               and count is incremented by 1.

    virtual void deleteNode(const Type& deleteItem) = 0;
      //Function to delete deleteItem from the list.
      //Postcondition: If found, the node containing 
      //               deleteItem is deleted from the list.
      //               first points to the first node, last
      //               points to the last node of the updated 
      //               list, and count is decremented by 1.

    linkedListIterator<Type> begin();
      //Function to return an iterator at the begining of the 
      //linked list.
      //Postcondition: Returns an iterator such that current is
      //               set to first.

    linkedListIterator<Type> end();
      //Function to return an iterator one element past the 
      //last element of the linked list. 
      //Postcondition: Returns an iterator such that current is
      //               set to NULL.

    linkedListType(); 
      //default constructor
      //Initializes the list to an empty state.
      //Postcondition: first = NULL, last = NULL, count = 0; 

    linkedListType(const linkedListType<Type>& otherList); 
      //copy constructor

    ~linkedListType();   
      //destructor
      //Deletes all the nodes from the list.
      //Postcondition: The list object is destroyed. 

protected:
    int count;   //variable to store the number of 
                 //elements in the list
    nodeType<Type> *first; //pointer to the first node of the list
    nodeType<Type> *last;  //pointer to the last node of the list

private: 
    void copyList(const linkedListType<Type>& otherList); 
      //Function to make a copy of otherList.
      //Postcondition: A copy of otherList is created and
      //               assigned to this list.
};


template <class Type>
bool linkedListType<Type>::isEmptyList() const
{
    return(first == NULL);
}

template <class Type>
linkedListType<Type>::linkedListType() //default constructor
{
    first = NULL;
    last = NULL;
    count = 0;
}

template <class Type>
void linkedListType<Type>::destroyList()
{
    nodeType<Type> *temp;   //pointer to deallocate the memory
                            //occupied by the node
    while (first != NULL)   //while there are nodes in the list
    {
        temp = first;        //set temp to the current node
        first = first->link; //advance first to the next node
        delete temp;   //deallocate the memory occupied by temp
    }
    last = NULL; //initialize last to NULL; first has already
                 //been set to NULL by the while loop
    count = 0;
}

template <class Type>
void linkedListType<Type>::initializeList()
{
	destroyList(); //if the list has any nodes, delete them
}

template <class Type>
void linkedListType<Type>::print() const
{
    nodeType<Type> *current; //pointer to traverse the list

    current = first;    //set current so that it points to 
                        //the first node
    while (current != NULL) //while more data to print
    {
        cout << current->info << " ";
        current = current->link;
    }
}//end print

template <class Type>
int linkedListType<Type>::length() const
{
    return count;
}  //end length

template <class Type>
Type linkedListType<Type>::front() const
{   
    assert(first != NULL);

    return first->info; //return the info of the first node	
}//end front

template <class Type>
Type linkedListType<Type>::back() const
{   
    assert(last != NULL);

    return last->info; //return the info of the last node	
}//end back

template <class Type>
linkedListIterator<Type> linkedListType<Type>::begin()
{
    linkedListIterator<Type> temp(first);

    return temp;
}

template <class Type>
linkedListIterator<Type> linkedListType<Type>::end()
{
    linkedListIterator<Type> temp(NULL);

    return temp;
}

template <class Type>
void linkedListType<Type>::copyList
                   (const linkedListType<Type>& otherList) 
{
    nodeType<Type> *newNode; //pointer to create a node
    nodeType<Type> *current; //pointer to traverse the list

    if (first != NULL) //if the list is nonempty, make it empty
       destroyList();

    if (otherList.first == NULL) //otherList is empty
    {
        first = NULL;
        last = NULL;
        count = 0;
    }
    else
    {
        current = otherList.first; //current points to the 
                                   //list to be copied
        count = otherList.count;

            //copy the first node
        first = new nodeType<Type>;  //create the node

        first->info = current->info; //copy the info
        first->link = NULL;        //set the link field of 
                                   //the node to NULL
        last = first;              //make last point to the
                                   //first node
        current = current->link;     //make current point to
                                     //the next node

           //copy the remaining list
        while (current != NULL)
        {
            newNode = new nodeType<Type>;  //create a node
            newNode->info = current->info; //copy the info
            newNode->link = NULL;       //set the link of 
                                        //newNode to NULL
            last->link = newNode;  //attach newNode after last
            last = newNode;        //make last point to
                                   //the actual last node
            current = current->link;   //make current point 
                                       //to the next node
        }//end while
    }//end else
}//end copyList

template <class Type>
linkedListType<Type>::~linkedListType() //destructor
{
   destroyList();
}//end destructor

template <class Type>
linkedListType<Type>::linkedListType
                      (const linkedListType<Type>& otherList)
{
   	first = NULL;
    copyList(otherList);
}//end copy constructor

         //overload the assignment operator
template <class Type>
const linkedListType<Type>& linkedListType<Type>::operator=
                      (const linkedListType<Type>& otherList)
{ 
    if (this != &otherList) //avoid self-copy
    {
        copyList(otherList);
    }//end else

     return *this; 
}

#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日日夜夜精品视频免费| 亚洲欧美一区二区三区国产精品| 亚洲bdsm女犯bdsm网站| 日本韩国视频一区二区| 亚洲午夜激情网站| 制服丝袜国产精品| 国产一区二区精品久久99| 国产三级欧美三级| 99久久99久久综合| 亚洲国产精品精华液网站| 在线国产亚洲欧美| 免费看欧美女人艹b| 久久久久久免费网| 99久久久精品| 亚洲第一精品在线| 精品国产一区二区三区av性色| 精彩视频一区二区三区| 欧美国产国产综合| 欧美人与z0zoxxxx视频| 男女性色大片免费观看一区二区| 久久久久久久综合狠狠综合| 波多野结衣中文字幕一区二区三区 | 不卡视频一二三四| 亚洲一区二区三区四区五区中文| 91麻豆精品国产91| 成人免费观看av| 偷拍亚洲欧洲综合| 国产精品美日韩| 欧美麻豆精品久久久久久| 国产精品一区在线| 亚洲在线一区二区三区| 久久香蕉国产线看观看99| 91美女片黄在线| 精品一区二区日韩| 亚洲免费av高清| 久久久精品国产免大香伊| 色婷婷狠狠综合| 国产精品白丝jk黑袜喷水| 亚洲综合一区二区三区| 久久久国产一区二区三区四区小说| 91丨九色丨蝌蚪富婆spa| 精品在线视频一区| 偷偷要91色婷婷| 亚洲精品美国一| 国产欧美精品国产国产专区| 欧美日本不卡视频| 日本精品一区二区三区高清| 国产91丝袜在线18| 精品一区二区三区免费观看| 亚洲国产日韩一级| 成人免费在线播放视频| 久久综合精品国产一区二区三区 | 欧美在线观看视频在线| 国产精品123| 麻豆91小视频| 天天操天天干天天综合网| 中文字幕国产一区| 国产亚洲人成网站| wwwwww.欧美系列| 日韩你懂的在线观看| 欧美日韩不卡在线| 91国模大尺度私拍在线视频| 成人午夜电影久久影院| 精品一区二区三区的国产在线播放 | 国产精品亚洲人在线观看| 日韩av在线发布| 亚洲成人av资源| 一区二区三区四区视频精品免费 | 久久精品99久久久| 日日夜夜免费精品| 午夜精品一区二区三区三上悠亚| 亚洲美女屁股眼交3| 中文字幕一区二区三| 国产情人综合久久777777| 国产午夜精品久久久久久免费视| 精品少妇一区二区三区 | 国产女人水真多18毛片18精品视频| 精品理论电影在线观看| 日韩视频永久免费| 日韩欧美一级在线播放| 精品国产一区二区亚洲人成毛片| 欧美一区二区免费视频| 欧美xxxx在线观看| 久久久久久久电影| 国产欧美精品一区二区色综合| 久久久高清一区二区三区| 国产日韩欧美综合一区| 国产精品另类一区| 18欧美乱大交hd1984| 亚洲欧洲制服丝袜| 亚洲国产va精品久久久不卡综合| 亚洲电影在线免费观看| 日本aⅴ精品一区二区三区| 男人的天堂久久精品| 韩国av一区二区三区| 成人h动漫精品一区二区| 色偷偷久久人人79超碰人人澡| 91国偷自产一区二区三区成为亚洲经典 | 欧美日本韩国一区| 精品国产欧美一区二区| 久久久99久久精品欧美| 中文字幕一区二区在线观看| 椎名由奈av一区二区三区| 亚洲高清一区二区三区| 久久国产欧美日韩精品| 国产精品亚洲午夜一区二区三区| caoporm超碰国产精品| 欧美日韩一区二区三区视频| 欧美变态tickling挠脚心| 国产精品网站导航| 亚洲高清免费视频| 国产麻豆精品在线| 欧美亚洲一区二区在线| 日韩免费成人网| 亚洲同性同志一二三专区| 午夜婷婷国产麻豆精品| 国产91综合一区在线观看| 欧美视频自拍偷拍| 久久午夜羞羞影院免费观看| 亚洲免费在线看| 国内一区二区在线| 欧美性xxxxxx少妇| 国产拍欧美日韩视频二区| 亚洲福利国产精品| 国产乱码一区二区三区| 欧美日韩免费一区二区三区| 国产女人aaa级久久久级| 石原莉奈在线亚洲二区| 成人晚上爱看视频| 正在播放一区二区| 亚洲精品国产第一综合99久久| 看片网站欧美日韩| 欧美性猛交xxxx乱大交退制版 | 国产欧美日韩另类一区| 亚洲成人av电影| 99国产麻豆精品| 久久久亚洲精华液精华液精华液| 亚洲一区二区三区不卡国产欧美 | 色综合天天狠狠| 国产午夜精品一区二区三区视频| 午夜精品一区二区三区电影天堂| 成人黄色777网| 久久久久青草大香线综合精品| 亚洲国产精品久久不卡毛片| jlzzjlzz欧美大全| 欧美国产乱子伦| 国产在线精品一区二区夜色| 欧美精品视频www在线观看| 综合中文字幕亚洲| 成人性色生活片免费看爆迷你毛片| 日韩精品一区二区在线| 午夜欧美在线一二页| 色综合中文综合网| 亚洲精品一区二区三区99| 亚洲国产成人av网| 色8久久人人97超碰香蕉987| 国产精品传媒入口麻豆| 丰满少妇久久久久久久| 久久精品视频一区二区三区| 狠狠狠色丁香婷婷综合激情| 欧美一区二区女人| 日本三级亚洲精品| 91精品婷婷国产综合久久性色 | 中文字幕日韩精品一区| 国产精品一区二区三区乱码| 精品久久久久久久一区二区蜜臀| 婷婷六月综合网| 91精品中文字幕一区二区三区| 一区二区三区四区高清精品免费观看| 97se亚洲国产综合自在线| 日韩毛片精品高清免费| av亚洲精华国产精华精华 | 一区二区视频在线| 91成人在线免费观看| 亚洲一卡二卡三卡四卡五卡| 色噜噜久久综合| 亚洲成人av中文| 91精品国产色综合久久ai换脸| 日韩精品乱码av一区二区| 日韩精品在线网站| 国产精品亚洲成人| 中文字幕一区av| 欧美三级视频在线观看| 日韩不卡手机在线v区| 精品日韩一区二区三区| 国产一区高清在线| 国产精品免费久久久久| 色综合天天狠狠| 日本欧美大码aⅴ在线播放| 精品欧美久久久| 99热99精品| 亚洲高清在线精品| 精品人在线二区三区| 成人精品一区二区三区中文字幕| ...xxx性欧美| 日韩色在线观看| 成人免费视频视频在线观看免费| 亚洲欧美激情在线| 日韩一区二区在线观看| 国产69精品久久777的优势|