freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

數(shù)據(jù)結(jié)構(gòu)實(shí)驗(yàn)報(bào)告冊(cè)(合集)-文庫(kù)吧

2024-10-20 03:48 本頁(yè)面


【正文】 *************************************************/ template struct Node { T data。Node *next。}。template class LinkStack { private: Node *top。public: LinkStack(){top=NULL。} ~LinkStack(){while(top){Node *p。p=topnext。delete top。top=p。}} void push(T x)。T pop()。T gettop(){if(top!=NULL)return topdata。} bool Empty(){top==NULL?return 1:return 0。} }。template void LinkStack::push(T x){ Node *s。s=new Node。//沒(méi)有申請(qǐng)空間時(shí) 會(huì)出現(xiàn)錯(cuò)誤!sdata=x。snext=top。top=s。} template T LinkStack::pop(){ T x。Node *p。if(top==NULL)throw “下溢”。x=topdata。p=top。top=topnext。delete p。return x。}/******************************************************/ void main(){ SeqStack aa。LinkStack bb。for(int i=1。i(i)。coutint k=0。k=()。cout”。}coutfor(i=1。i(i)。coutint j=0。j=()。cout”。} cout。要求::依次把 1,2,3,4,5入隊(duì),然后出隊(duì)中的數(shù)據(jù)元素并在屏幕上顯示。第二題源代碼: include include using namespace std。const int QueueSize=100。/**************************************/ template class CirQueue { public: T data[QueueSize]。int front, rear。CirQueue(){front=rear=0。}~ CirQueue(){}void EnQueue(T x){if((rear+1)% QueueSize ==front)throw “上溢”。rear=(rear+1)% QueueSize。data[rear]=x。} T GetQueue(){if(rear==front)throw “下溢”。int i=(front+1)% QueueSize。return data[i]。} T DeQueue(){if(rear==front)throw “下溢”。front=(front+1)% QueueSize。return data[front]。} }。/*********************************************/ template struct Node { T data。Node *next。}。/*********************************************/ template class LinkQueue { private: Node *front,*rear。//隊(duì)頭隊(duì)尾指針 public: LinkQueue()。~LinkQueue(){ } void EnQueue(T x)。//將x入隊(duì)T DeQueue()。//將隊(duì)頭元素出隊(duì)T GetQueue(){if(front!=rear)return frontnextdata。//取對(duì)頭元素} bool Empty()//判斷鏈隊(duì)列是否為空{(diào)front==rear?return 1:return 0。} }。/***************************************/ template LinkQueue::LinkQueue(){ Node *s。s=new Node。snext=NULL。//創(chuàng)建頭結(jié)點(diǎn)s front=rear=s。} /***************************************/ template void LinkQueue::EnQueue(T x){ Node *s。s=new Node。sdata=x。snext=NULL。rearnext=s。rear=s。} /***************************************/ template T LinkQueue::DeQueue(){ Node *p。T x。if(rear==front)throw“下溢”。p=frontnext。x=pdata。frontnext=pnext。if(pnext==NULL)rear=front。delete p。return x。} /***********************************************/ void main(){ CirQueue a。LinkQueue b。for(int i = 1。i (i)。(i)。} for(i = 1。i int k,j(0)。k = ()。j=()。cout”心得體會(huì):實(shí)驗(yàn)三 多維數(shù)組和廣義表的操作實(shí)驗(yàn)類(lèi)型:驗(yàn)證性 實(shí)驗(yàn)要求:必修 實(shí)驗(yàn)學(xué)時(shí): 2學(xué)時(shí)一、實(shí)驗(yàn)?zāi)康模簠⒄战o定的多維數(shù)組類(lèi)和廣義表類(lèi)的程序樣例,驗(yàn)證給出的多維數(shù)組和廣義表的常見(jiàn)算法,并實(shí)現(xiàn)有關(guān)的操作。二、實(shí)驗(yàn)要求:掌握多維數(shù)組和廣義表的特點(diǎn)。掌握它們的常見(jiàn)算法。提交實(shí)驗(yàn)報(bào)告,報(bào)告內(nèi)容包括:目的、要求、算法描述、程序結(jié)構(gòu)、主要變量說(shuō)明、程序清單、調(diào)試情況、設(shè)計(jì)技巧、心得體會(huì)。三、實(shí)驗(yàn)內(nèi)容:*n階的對(duì)稱(chēng)矩陣。要求:(1)實(shí)現(xiàn)將對(duì)稱(chēng)矩陣用一維數(shù)組存儲(chǔ)輸出。(2)實(shí)現(xiàn)矩陣轉(zhuǎn)置算法。(3)實(shí)現(xiàn)魔方陣算法。(4)設(shè)計(jì)一個(gè)測(cè)試?yán)?,并編?xiě)主程序進(jìn)行測(cè)試。第一題源代碼: include using namespace std。int a[10][10]。int save[100]。int main(){ int n,i,j。puts(“輸入矩陣的維數(shù) N”)。cin n。for(i = 0。i n。i++)for(j =0。j n。j++){a[i][j] = rand()% 10 + 1。a[j][i] = a[i][j]。}for(i = 0。i n。i++){for(j = 0。j n。j++)coutcout}puts(“轉(zhuǎn)化后: ”)。int k = 0。for(i = 0。i n。i++)for(j = 0。j {k = i *(i + 1)/ 2 + j。save[k] = a[i][j]。k++。}for(i = 0。i n *(n + 1)/ 2。i++)coutcout運(yùn)行結(jié)果: include using namespace std。const int MaxTerm=100。template struct element { int row, col。T item。}。struct SparseMatrix { element data[MaxTerm]。int mu, nu, tu。}。void Trans1(SparseMatrix A, SparseMatrix amp。B){ =。=。=。if(0){int pb = 0。for(int col = 0。colfor(int pa = 0。pa 。pa++)if([pa].col==col){[pb].row= [pa].col。[pb].col= [pa].row。[pb].item= [pa].item。pb++。} } } int main(){ int i。SparseMatrix AA,BB。puts(“輸入行數(shù) 列數(shù) 非零元素個(gè)數(shù)”)。cin 。puts(“輸入三元表:”)。//puts()與 cout 一樣for(i = 0。i 7。i++){cin [i].row。cin [i].col。cin [i].item。} Trans1(AA,BB)。puts(“輸出三元表237。:”)。for(i = 0。i 7。i++){coutcoutcoutreturn 0。} 運(yùn)行結(jié)果:心得體會(huì):實(shí)驗(yàn)四 樹(shù)和二叉樹(shù)實(shí)驗(yàn)類(lèi)型:驗(yàn)證性 實(shí)驗(yàn)要求:必修 實(shí)驗(yàn)學(xué)時(shí): 2學(xué)時(shí)一、實(shí)驗(yàn)?zāi)康模簠⒄战o定的二叉樹(shù)類(lèi)的程序樣例,驗(yàn)證給出的有關(guān)二叉樹(shù)的常見(jiàn)算法,并實(shí)現(xiàn)有關(guān)的操作。二、實(shí)驗(yàn)要求:掌握二叉樹(shù)、哈夫曼樹(shù)和樹(shù)的特點(diǎn)。掌握它們的常見(jiàn)算法。提交實(shí)驗(yàn)報(bào)告,報(bào)告內(nèi)容包括:目的、要求、算法描述、程序結(jié)構(gòu)、主要變量說(shuō)明、程序清單、調(diào)試情況、設(shè)計(jì)技巧、心得體會(huì)。三、實(shí)驗(yàn)內(nèi)容:1.設(shè)計(jì)實(shí)現(xiàn)二叉樹(shù)類(lèi),要求:(1)編寫(xiě)一個(gè)程序,首先建立不帶頭結(jié)點(diǎn)的二叉鏈?zhǔn)酱鎯?chǔ)結(jié)構(gòu)的二叉樹(shù),然后分別輸出按
點(diǎn)擊復(fù)制文檔內(nèi)容
環(huán)評(píng)公示相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1