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

蟲蟲首頁| 資源下載| 資源專輯| 精品軟件
登錄| 注冊

boX

  • 數據結構實驗

    #include <iostream> #include <stdio.head> #include <stdlib.head> #include <string.head> #define ElemType int #define max 100 using namespace std; typedef struct node1 { ElemType data; struct node1 *next; }Node1,*LinkList;//鏈棧 typedef struct { ElemType *base; int top; }SqStack;//順序棧 typedef struct node2 { ElemType data; struct node2 *next; }Node2,*LinkQueue; typedef struct node22 { LinkQueue front; LinkQueue rear; }*LinkList;//鏈隊列 typedef struct { ElemType *base; int front,rear; }SqQueue;//順序隊列 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 //1.采用鏈式存儲實現棧的初始化、入棧、出棧操作。 LinkList CreateStack()//創建棧 { LinkList top; top=NULL; return top; } bool StackEmpty(LinkList s)//判斷棧是否為空,0代表空 { if(s==NULL) return 0; else return 1; } LinkList Pushead(LinkList s,int x)//入棧 { LinkList q,top=s; q=(LinkList)malloc(sizeof(Node1)); q->data=x; q->next=top; top=q; return top; } LinkList Pop(LinkList s,int &e)//出棧 { if(!StackEmpty(s)) { printf("棧為空。"); } else { e=s->data; LinkList p=s; s=s->next; free(p); } return s; } void DisplayStack(LinkList s)//遍歷輸出棧中元素 { if(!StackEmpty(s)) printf("棧為空。"); else { wheadile(s!=NULL) { cout<<s->data<<" "; s=s->next; } cout<<endl; } } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 //2.采用順序存儲實現棧的初始化、入棧、出棧操作。 int StackEmpty(int t)//判斷棧S是否為空 { SqStack.top=t; if (SqStack.top==0) return 0; else return 1; } int InitStack() { SqStack.top=0; return SqStack.top; } int pushead(int t,int e) { SqStack.top=t; SqStack.base[++SqStack.top]=e; return SqStack.top; } int pop(int t,int *e)//出棧 { SqStack.top=t; if(!StackEmpty(SqStack.top)) { printf("棧為空."); return SqStack.top; } *e=SqStack.base[s.top]; SqStack.top--; return SqStack.top; } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 //3.采用鏈式存儲實現隊列的初始化、入隊、出隊操作。 LinkList InitQueue()//創建 { LinkList head; head->rear=(LinkQueue)malloc(sizeof(Node)); head->front=head->rear; head->front->next=NULL; return head; } void deleteEle(LinkList head,int &e)//出隊 { LinkQueue p; p=head->front->next; e=p->data; head->front->next=p->next; if(head->rear==p) head->rear=head->front; free(p); } void EnQueue(LinkList head,int e)//入隊 { LinkQueue p=(LinkQueue)malloc(sizeof(Node)); p->data=e; p->next=NULL; head->rear->next=p; head->rear=p; } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 //4.采用順序存儲實現循環隊列的初始化、入隊、出隊操作。 bool InitQueue(SqQueue &head)//創建隊列 { head.data=(int *)malloc(sizeof(int)); head.front=head.rear=0; return 1; } bool EnQueue(SqQueue &head,int e)//入隊 { if((head.rear+1)%MAXQSIZE==head.front) { printf("隊列已滿\n"); return 0; } head.data[head.rear]=e; head.rear=(head.rear+1)%MAXQSIZE; return 1; } int QueueLengthead(SqQueue &head)//返回隊列長度 { return (head.rear-head.front+MAXQSIZE)%MAXQSIZE; } bool deleteEle(SqQueue &head,int &e)//出隊 { if(head.front==head.rear) { cout<<"隊列為空!"<<endl; return 0; } e=head.data[head.front]; head.front=(head.front+1)%MAXQSIZE; return 1; } int gethead(SqQueue head)//得到隊列頭元素 { return head.data[head.front]; } int QueueEmpty(SqQueue head)//判斷隊列是否為空 { if (head.front==head.rear) return 1; else return 0; } void travelQueue(SqQueue head)//遍歷輸出 { wheadile(head.front!=head.rear) { printf("%d ",head.data[head.front]); head.front=(head.front+1)%MAXQSIZE; } cout<<endl; } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 //5.在主函數中設計一個簡單的菜單,分別測試上述算法。 int main() { LinkList top=CreateStack(); int x; wheadile(scanf("%d",&x)!=-1) { top=Pushead(top,x); } int e; wheadile(StackEmpty(top)) { top=Pop(top,e); printf("%d ",e); }//以上是鏈棧的測試 int top=InitStack(); int x; wheadile(cin>>x) top=pushead(top,x); int e; wheadile(StackEmpty(top)) { top=pop(top,&e); printf("%d ",e); }//以上是順序棧的測試 LinkList Q; Q=InitQueue(); int x; wheadile(scanf("%d",&x)!=-1) { EnQueue(Q,x); } int e; wheadile(Q) { deleteEle(Q,e); printf("%d ",e); }//以上是鏈隊列的測試 SqQueue Q1; InitQueue(Q1); int x; wheadile(scanf("%d",&x)!=-1) { EnQueue(Q1,x); } int e; wheadile(QueueEmpty(Q1)) { deleteEle(Q1,e); printf("%d ",e); } return 0; }

    標簽: 數據結構 實驗

    上傳時間: 2018-05-09

    上傳用戶:123456..

  • java編程 PL0編譯器(Java版)

    實現一個Java版的PL0編譯器。 (1) 能運行由《編譯原理》教材中定義的PL0語言編寫而成的源程序 (2) 參考C版源代碼,遵循編譯器的基本結構,應用面向對象軟件設計方法重新實現。不應僅對C版代碼作簡單的翻譯。 (3) 提供簡單的斷點、單步調試功能,用戶能實時指定并查看某個變量的值 (4) 包括測試例子 直接運行jar文件 簡單說明文檔

    標簽: java Java PL0 編程 編譯器

    上傳時間: 2018-05-13

    上傳用戶:aloger

  • usbip驅動 Windows源碼

    開源項目,USBIP客戶端代碼,2.0版本

    標簽: Windows usbip 驅動 源碼

    上傳時間: 2018-06-28

    上傳用戶:ley.x

  • DCU32INT

    破解一個第三方控件的dcu

    標簽: DCU INT 32

    上傳時間: 2018-07-27

    上傳用戶:chinacoho

  • 算法與數據結構課程設計

    拓撲排序 ---排課表----數據結構

    標簽: 算法 數據結構

    上傳時間: 2018-08-05

    上傳用戶:ningcaichen

  • C程序設計語言(完美中文版).pdf

    C程序設計語言(完美中文版).pdf C程序設計語言(完美中文版).pdf

    標簽: pdf C程序設計 語言

    上傳時間: 2018-08-20

    上傳用戶:superhou

  • 數據挖掘-聚類-K-means算法Java實現

    K-Means算法是最古老也是應用最廣泛的聚類算法,它使用質心定義原型,質心是一組點的均值,通常該算法用于n維連續空間中的對象。 K-Means算法流程 step1:選擇K個點作為初始質心 step2:repeat                將每個點指派到最近的質心,形成K個簇                重新計算每個簇的質心             until 質心不在變化  例如下圖的樣本集,初始選擇是三個質心比較集中,但是迭代3次之后,質心趨于穩定,并將樣本集分為3部分    我們對每一個步驟都進行分析 step1:選擇K個點作為初始質心 這一步首先要知道K的值,也就是說K是手動設置的,而不是像EM算法那樣自動聚類成n個簇 其次,如何選擇初始質心      最簡單的方式無異于,隨機選取質心了,然后多次運行,取效果最好的那個結果。這個方法,簡單但不見得有效,有很大的可能是得到局部最優。      另一種復雜的方式是,隨機選取一個質心,然后計算離這個質心最遠的樣本點,對于每個后繼質心都選取已經選取過的質心的最遠點。使用這種方式,可以確保質心是隨機的,并且是散開的。 step2:repeat                將每個點指派到最近的質心,形成K個簇                重新計算每個簇的質心             until 質心不在變化  如何定義最近的概念,對于歐式空間中的點,可以使用歐式空間,對于文檔可以用余弦相似性等等。對于給定的數據,可能適應與多種合適的鄰近性度量。

    標簽: K-means Java 數據挖掘 聚類 算法

    上傳時間: 2018-11-27

    上傳用戶:1159474180

  • ADI DSP BootLoader

    開發工具是VisualDsp++,這個基于ADSP BF518開發板,功能通過串口口接收并燒寫flash,Bootloader升級程序。

    標簽: BootLoader ADI DSP

    上傳時間: 2019-01-12

    上傳用戶:guoenci123

  • JAVA SMPP 源碼

    Introduction jSMPP is a java implementation (SMPP API) of the SMPP protocol (currently supports SMPP v3.4). It provides interfaces to communicate with a Message Center or an ESME (External Short Message Entity) and is able to handle traffic of 3000-5000 messages per second. jSMPP is not a high-level library. People looking for a quick way to get started with SMPP may be better of using an abstraction layer such as the Apache Camel SMPP component: http://camel.apache.org/smpp.html Travis-CI status: History The project started on Google Code: http://code.google.com/p/jsmpp/ It was maintained by uudashr on Github until 2013. It is now a community project maintained at http://jsmpp.org Release procedure mvn deploy -DperformRelease=true -Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/ -DrepositoryId=sonatype-nexus-staging -Dgpg.passphrase=<yourpassphrase> log in here: https://oss.sonatype.org click the 'Staging Repositories' link select the repository and click close select the repository and click release License Copyright (C) 2007-2013, Nuruddin Ashr uudashr@gmail.com Copyright (C) 2012-2013, Denis Kostousov denis.kostousov@gmail.com Copyright (C) 2014, Daniel Pocock http://danielpocock.com Copyright (C) 2016, Pim Moerenhout pim.moerenhout@gmail.com This project is licensed under the Apache Software License 2.0.

    標簽: JAVA SMPP 源碼

    上傳時間: 2019-01-25

    上傳用戶:dragon_longer

  • KCFdemo實現目標選取,跟蹤

    程序可以實現,鼠標框選目標之后,跟蹤所選目標 操作過程: 1:運行程序 2:選定方式,例如輸入1.選定視頻流 3:選中視頻顯示框 4:輸入字符p 5:鼠標框選區域 6:輸入字符p,實現跟蹤

    標簽: KCFdemo

    上傳時間: 2019-02-18

    上傳用戶:wsfgq

主站蜘蛛池模板: 长乐市| 梅河口市| 乐陵市| 乌兰浩特市| 当雄县| 扬中市| 惠来县| 镇赉县| 青田县| 江达县| 萨嘎县| 龙胜| 沈阳市| 博客| 吉木萨尔县| 铜陵市| 丰镇市| 二连浩特市| 屏南县| 江都市| 资源县| 清水河县| 开封县| 始兴县| 正镶白旗| 景东| 石林| 江永县| 万源市| 平昌县| 棋牌| 莫力| 东方市| 垣曲县| 明水县| 徐闻县| 松江区| 兴安盟| 阳泉市| 乐昌市| 肇州县|