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

正文內(nèi)容

算法與數(shù)據(jù)結(jié)構(gòu)實驗報告-展示頁

2024-08-19 05:33本頁面
  

【正文】 PE amp。count++。snext=top。}error_code linkstack::push(const DATA_TYPE x){LNode *s=new LNode。count=0。}。int count。error_code pop()。error_code get_top(DATA_TYPE amp。bool empty()const。enum error_code{range_error,success,underflowclass linkstack{public:linkstack()。LNode *next。typedef int DATA_TYPE。實驗原理:依次將棧中的元素出棧,因為棧的一個特點就是先進后出,這樣,當(dāng)將原棧為空時,輸出與輸入次序相反,從而實現(xiàn)了本題的要求。(1)。num1=num2。coutnum1+num2 。j++){(num2)。for(j=0。int k=0。i=7。num2=1。(1)。int i=0。 }void main(){queue Q。return success。}}error_code queue::serve(){if(empty())return underflow。else{data[rear%MAXLEN]=x。return success。x)const {if(empty())return underflow。}bool queue::empty()const{return (front%MAXLEN==rear%MAXLEN)。queue::queue(){rear=0。DATA_TYPE data[MAXLEN]。bool full()const。 error_code append(const DATA_TYPE x)。error_code get_front(DATA_TYPE amp。class queue{public:queue()。const int MAXLEN=100。程序清單:includeiostreamincludecstdlibusing namespace std。為此,需要用隊列來保存上一行的內(nèi)容。(n=8)實驗原理:楊輝三角的規(guī)律是每行的第一和最后一個數(shù)是1,從第三行開始的其余的數(shù)是上一行對應(yīng)位置的左右兩個數(shù)之和。()。}while(!()){(x)。()。while(!()){(N)。N=N/d。if(N==0){cout輸出轉(zhuǎn)換結(jié)果:Nendl。cout請輸入一個十進制數(shù)N和所需轉(zhuǎn)換的進制dendl。}void main(){stack S。return success。}}error_code stack::pop(){if(empty())return underflow。else{data[count]=x。return success。x)constif(empty())return underflow。}bool stack::empty()const{return count==0。}。private:DATA_TYPE data[MAXLEN]。error_code pop()。x)const。bool empty()const。enum error_code{success,overflow,underflow}。typedef int DATA_TYPE。此時,將前面所得到的各余數(shù)反過來連接便得到最后的轉(zhuǎn)換結(jié)果。實驗任務(wù):,利用棧的基本操作完成十進制數(shù)N與其它d進制數(shù)的轉(zhuǎn)換。. . . . .算法與數(shù)據(jù)結(jié)構(gòu)實驗報告學(xué)院:計算機與信息學(xué)院專業(yè)班級:姓名:學(xué)號:實驗一 棧和隊列實驗?zāi)康模赫莆諚:完犃刑攸c、邏輯結(jié)構(gòu)和存儲結(jié)構(gòu)熟悉對棧和隊列的一些基本操作和具體的函數(shù)定義。利用棧和隊列的基本操作完成一定功能的程序。(如N=1357,d=8)實驗原理:將十進制數(shù)N轉(zhuǎn)換為八進制時,采用的是“除取余數(shù)法”,即每次用8除N所得的余數(shù)作為八進制數(shù)的當(dāng)前個位,將相除所得的商的整數(shù)部分作為新的N值重復(fù)上述計算,直到N為0為止。程序清單:includeiostreamincludecstdlibusing namespace std。const int MAXLEN=100。class stack{public:stack()。error_code get_top(DATA_TYPE amp。error_code push(const DATA_TYPE x)。bool full()const。int count。stack::stack(){count=0。}error_code stack::get_top(DATA_TYPE amp。else{x=data[count1]。}}error_code stack::push(const DATA_TYPE x){if(full())return overflow。count++。else{count。}}bool stack::full()const{return count==MAXLEN。int N,d。cinNd。}while(N)(N%d)。}cout輸出轉(zhuǎn)換結(jié)果:endl。coutN。}coutendl。coutx。}}測試數(shù)據(jù):N=1348 d=8運行結(jié)果:,并利用隊列計算并打印楊輝三角的前n行的內(nèi)容。因此,可用上一行的數(shù)來求出對應(yīng)位置的下一行內(nèi)容。每當(dāng)由上一行的兩個數(shù)求出下一行的一個數(shù)時,其中的前一個便需要刪除,而新求出的數(shù)就要入隊。typedef int DATA_TYPE。enum error_code{success,underflow,overflow}。bool empty()const。x)const。 error_code serve()。private:int front,rear。}。front=0。}error_code queue::get_front(DATA_TYPE amp。else{x=data[front%MAXLEN]。}}error_code queue::append(const DATA_TYPE x) {if(full())return overflow。rear++。else{front++。}}bool queue::full()const{return((rear+1)%MAXLEN==front)。int num1,num2。cout1endl。num1=0。for(i=0。i++){int j=0。num1=0。j=i。()。(num1+num2)。}cout1endl。}}運行結(jié)果:,并設(shè)計程序完成如下功能:讀入一個有限大小的整數(shù)n,并讀入n個數(shù),然后按照與輸入次序相反的次序輸出各元素的值。程序清單:includeiostreamincludecstdlibusing namespace std。typedef struct LNode{DATA_TYPE data。}LNode。~linkstack()。error_code push(const DATA_TYPE x)。x)const。private:LNode *top。DATA_TYPE data。linkstack::linkstack(){top=NULL。}bool linkstack::empty()const{return (count==0)。sdata=x。top=s。return success。x)const{if(empty())return underflow。return success。else{LNode *u=new LNode。top=topnext。count。}}linkstack::~linkstack(){while(!empty()){pop()。int n。cinn。i=n。}while(!()){(i)。()。熟練掌握動態(tài)鏈表結(jié)構(gòu)及有關(guān)算法的設(shè)計。實驗任務(wù):,并保持其遞增有序特性。 實驗原理:給出了要插入的條件,但沒有給定插入位置。程序清單:include iostreamusing namespace std。typedef int elementtype 。 struct LinkNode *next。 class list{private: int count。public: list()。public: error_code get_element(const int i, elementtype amp。 node * get_head() const {return head。 void display()。}。 head next = NULL。}void list::create(){ elementtype x。 cin x。 while ( x != 9999 ){ count ++。 s data = x。 re
點擊復(fù)制文檔內(nèi)容
研究報告相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1