虫虫首页| 资源下载| 资源专辑| 精品软件
登录| 注册

Head

  • 数据结构实验

    #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..

  • css美化有序列表

    css美化有序列表,贴出部分css代码         <ol >             <li>先涂粉底再涂防晒</li>             <li>先涂防晒再涂粉底</li>         </ol> <!doctype html> <html> <Head> <title>CSS3 ordered list styles - demo</title> <style> body{ margin: 40px auto; width: 500px; } /* -------------------------------------- */ ol{ counter-reset: li; list-style: none; *list-style: decimal; font: 15px 'trebuchet MS', 'lucida sans'; padding: 0; margin-bottom: 4em; text-shadow: 0 1px 0 rgba(255,255,255,.5); } ol ol{ margin: 0 0 0 2em; } /* -------------------------------------- */

    标签: css 美化 序列

    上传时间: 2018-08-22

    上传用户:53660542

  • Advances+in+Mobile+Radio+Access+Networks

    This book gives a comprehensive overview of the technologies for the advances of mobile radio access networks. The topics covered include linear transmitters, superconducting filters and cryogenic radio frequency (RF) front Head, radio over fiber, software radio base stations, mobile terminal positioning, high speed downlink packet access (HSDPA), multiple antenna systems such as smart antennas and multiple input and multiple output (MIMO) systems, orthogonal frequency division multiplexing (OFDM) systems, IP-based radio access networks (RAN), autonomic networks, and ubiquitous networks. 

    标签: Advances Networks Access Mobile Radio in

    上传时间: 2020-05-26

    上传用户:shancjb

  • Spectrum+and+Energy+Efficient

    Heterogeneous Network (HetNet): A network that consists of a mix of macro cells and low-power nodes, e.g. Pico, Femto, Relay Node (RN) and Remote Radio Head (RRH)

    标签: Efficient Spectrum Energy and

    上传时间: 2020-06-01

    上传用户:shancjb

  • Power Over Ethernet

    December 2007, San Jose, California: It seems a long time ago. I walked into a big networking company to Head their small Power over Ethernet (PoE) applications team. Surprisingly, I hardly knew anything about PoE prior to that day, having been a switching-power conversion engineer almost all my life. But it seemed a great opportunity to widen my horizons. As you can see, one notable outcome of that seemingly illogical career choice five years ago is the book you hold in your hands today. I hope this small body of work goes on to prove worthy of your expectations and also of all the effort that went into it. Because, behind the scenes, there is a rather interesting story to relate—about its backdrop, intertwined with a small slice of modern PoE history, punctuated by a rather res- tive search for our roots and our true heroes, one that takes us back almost two centuries

    标签: Ethernet Power Over

    上传时间: 2020-06-07

    上传用户:shancjb

  • Head First Java.第二版.中文完整高清版

    HeadFirstJava》是一本完整地面向对象(object-oriented,OO)程序设计和Java的学习指导用书,根据学习理论所设计,你可以从程序语言的基础开始,到线程、网络与分布式程序等项目。重要的是,你可以学会如何像一个面向对象开发者一样去思考,而且不只是读死书。  在这里,你可以会玩游戏、拼图、解谜题以及以意想不到的方式与Java交互。  在这些活动中,你还会写出一堆真正的Java程序,如一个船舰炮战游戏和一个网络聊天程序等等。  “HeadFirst系列”图文并茂学习方式能让你快速地在脑海中掌握住知识,敞开心胸准备好学习这些关键性的主题:  ★Java程序语言  ★面向对象程序开发  ★Swing图形化接口  ★使用JavaAPI函数库  ★编写、测试与布署应用程序  ★处理异常;多线程  ★网络程序设计  ★集合与泛型

    标签: java

    上传时间: 2022-06-12

    上传用户: