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

ElemType

  • #include"c1.h" typedef int ElemType #include"c2-2.h" #include"bo2-4.cpp" void MergeList_C

    #include"c1.h" typedef int ElemType #include"c2-2.h" #include"bo2-4.cpp" void MergeList_CL(LinkList &La,LinkList Lb) { LinkList p=Lb->next Lb->next=La->next La->next=p->next free(p) La=Lb }

    标签: include MergeList_C ElemType typedef

    上传时间: 2016-03-03

    上传用户:rishian

  • 《数据结构C语言版》清大-严蔚敏 抽象数据类型Triplet和ElemType的详细定义

    《数据结构C语言版》清大-严蔚敏 抽象数据类型Triplet和ElemType的详细定义

    标签: ElemType Triplet 数据结构 C语言

    上传时间: 2016-07-29

    上传用户:bakdesec

  • 抽象数据类型Triplet和ElemType 的检验函数

    抽象数据类型Triplet和ElemType 的检验函数

    标签: ElemType Triplet 抽象数据类型 函数

    上传时间: 2016-07-29

    上传用户:wxhwjf

  • 数据结构 课程 2叉树的遍历 #include "stdafx.h" #include <iostream.h> typedef char ElemType

    数据结构 课程 2叉树的遍历 #include "stdafx.h" #include <iostream.h> typedef char ElemType

    标签: include ElemType iostream typedef

    上传时间: 2013-11-30

    上传用户:tb_6877751

  • 问题描述 假设停在铁路调度站入口处的车厢序列的编号依次为1

    问题描述 假设停在铁路调度站入口处的车厢序列的编号依次为1,2,3..n。设计一个程序,求出所有可能由此输出的的长度为n的车厢序列。 基本要求 在栈的顺序存储结构SqStack之上实现栈的五种基本要求,即实现栈类型。除了栈初始化操作之外,都要按函数实现。Push(s,x)是一个布尔函数,当且仅当栈s上溢出时返回“假“值;再说明一个ElemType型的常量StackEmptyMark,操作pop(s)和top(s)遇到栈s为空的情况时返回值StackEmptyMark。程序对栈的任何存取必须借助于基本操作要求。

    标签: 调度 序列

    上传时间: 2015-08-24

    上传用户:王者A

  • 创建一棵二叉排序树

    创建一棵二叉排序树,并采用中序遍历和层次遍历法输出其顶点序列,主要实验内容如下: 1. 定义二叉排序树的结构BiTree; 2. 编制二叉排序树的插入算法:void Insert_SortTree (BiTree ST, ElemType x); 3. 编制中序遍历函数; 4. 在main()函数中完成二叉排序树的建立,以及中序遍历的输出。(二叉排序树的各个元素从键盘输入,并利用Insert_SortTree()函数进行插入建立); 5. 编制层次遍历函数,并在main()函数中完成层次遍历的输出。层次遍历法要利用“队列”来实现;为此需要定义一个队列结构(可以采用链队列,也可以采用循环顺序队列),并实现相关的队列函数。

    标签: 排序

    上传时间: 2013-12-24

    上传用户:kikye

  • // algo3-12.cpp 银行业务模拟。实现算法3.6、3.7的程序 #define Qu 4 // 客户队列数 #define Khjg 5 // 两相邻到达的客户的时间间隔最大值

    // algo3-12.cpp 银行业务模拟。实现算法3.6、3.7的程序 #define Qu 4 // 客户队列数 #define Khjg 5 // 两相邻到达的客户的时间间隔最大值 #define Blsj 30 // 每个客户办理业务的时间最大值 #include"c1.h" typedef struct // 定义ElemType为结构体类型 { int OccurTime // 事件发生时刻 int NType // 事件类型,Qu表示到达事件,0至Qu-1表示Qu个窗口的离开事件 }Event,ElemType // 事件类型,有序链表LinkList的数据元素类型

    标签: define algo Khjg 3.6

    上传时间: 2016-03-03

    上传用户:jcljkh

  • 单链表习题

    链表习题 1. 编程实现链表的基本操作函数。 (1). void CreatList(LinkList &La,int m) //依次输入m个数据,并依次建立各个元素结点,逐个插入到链表尾;建立带表头结点的单链表La; (2). void ListPrint(LinkList La)  //将单链表La的数据元素从表头到表尾依次显示。 (3).void ListInsert (LinkList &L,int i,ElemType e){ //在带头结点的单链表L中第i个数据元素之前插入数据元素e (4). void ListDelete(LinkList &La, int n, ElemType &e) //删除链表的第n个元素,并用e返回其值。 (5). int Search(LinkList L, ElemType x) //在表中查找是否存在某个元素x,如存在则返回x在表中的位置,否则返回0。 (6). int ListLength(LinkList L)    //求链表L的表长 (7). void GetElem(LinkList L, int i, ElemType &e)   //用e返回L中第i个元素的值 链表的结点类型定义及指向结点的指针类型定义可以参照下列代码:    typedef  struct  Node{     ElemType     data;       // 数据域   struct   Node  *next;    // 指针域 }LNode, *LinkList;

    标签: 单链表

    上传时间: 2017-11-15

    上传用户:BIANJIAXIN

  • 单链表习题

    1. 编程实现链表的基本操作函数。 (1). void CreatList(LinkList &La,int m) //依次输入m个数据,并依次建立各个元素结点,逐个插入到链表尾;建立带表头结点的单链表La; (2). void ListPrint(LinkList La)  //将单链表La的数据元素从表头到表尾依次显示。 (3).void ListInsert (LinkList &L,int i,ElemType e){ //在带头结点的单链表L中第i个数据元素之前插入数据元素e (4). void ListDelete(LinkList &La, int n, ElemType &e) //删除链表的第n个元素,并用e返回其值。 (5). int Search(LinkList L, ElemType x) //在表中查找是否存在某个元素x,如存在则返回x在表中的位置,否则返回0。 (6). int ListLength(LinkList L)    //求链表L的表长 (7). void GetElem(LinkList L, int i, ElemType &e)   //用e返回L中第i个元素的值 链表的结点类型定义及指向结点的指针类型定义可以参照下列代码:    typedef  struct  Node{     ElemType     data;       // 数据域   struct   Node  *next;    // 指针域 }LNode, *LinkList;

    标签: 单链表

    上传时间: 2017-11-15

    上传用户:BIANJIAXIN

  • 数据结构实验

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