摘要:
#include #include #include const int ITEMNUM = 100;#define ElemType int//冒泡排序void Bubblesort(ElemType R[],int n,int &comp_num,int &move_num){int i,j,flag=1; //当flag为0,则停止排序ElemType temp;for(i = 0;i temp)&&(i0){comp_num++;for (i=d;i=0&&R[j]>R[j+d]){temp=R[j];R[j]=R[j+d];R[j 阅读全文
posted @ 2012-06-17 14:12
程序流程图
阅读(596)
评论(0)
推荐(0)
摘要:
//图 #include #include #define MaxNum 100typedef char Type;//邻接矩阵类型定义typedef struct {Type vexs[MaxNum];int edges[MaxNum][MaxNum];int Vertex_num,edge_num;}MGraph;//邻接表类型定义typedef struct node{int adjvex;struct node *next;}EdgeNode;typedef struct{struct{ Type vertex; EdgeNode * firstedge;}VertexNode[Max 阅读全文
posted @ 2012-06-17 14:09
程序流程图
阅读(320)
评论(0)
推荐(0)
摘要:
//链式结构#include #include #include #define MAXSIZE 1000typedef char ElemType;typedef struct LNode{//定义单链表结点类型ElemType data;struct LNode *next;}LinkList;void InitList(LinkList *&L){//带头结点的单链表L = (LinkList *)malloc(sizeof(LinkList));L -> next = NULL;}void DestroyList(LinkList *&L){LinkList *p 阅读全文
posted @ 2012-06-17 14:02
程序流程图
阅读(2544)
评论(0)
推荐(0)
摘要:
//对顺序表的操作#include#include #include#define MAXSIZE 1000typedef char ElemType;typedef struct{ElemType data[MAXSIZE];int length;}SqList;//初始化线性表void InitList(SqList*&L){L=(SqList*)malloc(sizeof(SqList));L->length=0;}//销毁线性表void DestoryList(SqList*&L){free(L);}//判断线性表是否为空int ListEmpty(SqList* 阅读全文
posted @ 2012-06-17 13:58
程序流程图
阅读(2664)
评论(0)
推荐(0)
摘要:
#include #include #define MaxSize 100typedef struct node{char data;/*此例中二叉树的结点采用字符类型*/struct node *lchild,*rchild;}NODE;/*按先序遍历序列创建二叉树的二叉链表*/NODE *crt_bt_pre(){NODE *bt;char ch;flushall();scanf("%c",&ch);if(ch == '0')bt = NULL;else{bt = new NODE;bt -> data = ch;printf(" 阅读全文
posted @ 2012-06-17 13:56
程序流程图
阅读(2775)
评论(0)
推荐(0)