別人寫的雙鏈表

2021-05-03 21:48:05 字數 971 閱讀 9345

寫了個雙向鍊錶

#include

template

struct nodetype

;template

class doublelist

;template

const doublelist& doublelist::operator=(const doublelist& otherlist)

if(this != &otherlist)

else

else

pointer = pointer->link;

}   }}

return *this;

}template

doublelist::~doublelist()

//cout<<"析構函式被呼叫"doublelist::doublelist()

template

void doublelist::initializelist()

template

bool doublelist::isemptylist()

template

void  doublelist::destory()

}template

void doublelist::print()

}template

void doublelist::rprint()

}template

int doublelist::length()

return count;

}template

void doublelist::insertitem(const type& insertitem)

else

}if( bfind )

else

else

newnode->link = null;

newnode->info = insertitem;}}

void main()

單鏈表 雙鏈表

實現乙個單鏈表,鍊錶初始為空,支援三種操作 1 向煉表頭插入乙個數 2 刪除第k個插入的數後面的數 3 在第k個插入的數後插入乙個數 現在要對該鍊錶進行m次操作,進行完所有操作後,從頭到尾輸出整個鍊錶。注意 題目中第k個插入的數並不是指當前鍊錶的第k個數。例如操作過程中一共插入了n個數,則按照插入的...

雙鏈表的實現

雙鏈表 1 雙向鍊錶 double linked list 雙 向 鍊錶中有兩條方向不同的鏈,即每個結點中除next域存放後繼結點位址外,還增加乙個指向其直接前趨的指標域prior。注意 雙鏈表由頭指標head惟一確定的。帶頭結點的雙鏈表的某些運算變得方便。將頭結點和尾結點鏈結起來,為雙 向 迴圈鍊...

雙鏈表的建立

資料結構程式設計練習 三 功能1 完成雙向鍊錶的初始化。功能2 實現雙向鍊錶的輸入資料功能。功能3 實現雙向鍊錶求表長功能。功能4 刪除雙向鍊錶中第i個元素結點,需返回第i個是否存在的狀態,並返回刪除值。功能5 檢查雙向鍊錶是否對稱,輸入多個資料進行驗證。功能6 其他功能請自行編寫,驗收時講解給驗收...