#include#includetypedef char dataType;struct TreeNode{ dataType data; TreeNode *left,*right; t
#include#include#include#define N 20//直接插入排序void InsertSort(int a[],int n){ int i,j,temp; for(i=1;i<N;i++){ temp = a[i]; j = i-1; while(j>=0 && a[j]>temp){ a[j+1] = a[j]; j--; } a[j+1]
实验主要要通过产生随机数进行数据的一次排序#include#include#include#define N 20//冒泡排序1---从前往后的冒泡排序 void bubble1(int a[],int n){ int i,j,t; for(i=1;i<n;i++){ for(j=0;j<n-i;j++){ if(a[j]>a[j+1]){ t = a[j];
#include#include#include typedef int dataType;typedef struct node{ dataType data; struct node *next;}LinkStack;//初始化顺序栈LinkStack *InitStack(){ LinkStack *t = (LinkStack*)malloc(size
#include#includetypedef char dataType;struct TreeNode{ dataType data; TreeNode *left,*right;};//创建二叉= x){ t
#include#include#define maxsize 100typedef int dataType;typedef struct{ dataType data[maxsize]; int top; }Seqstack;//创
#include#include#define maxsize 100typedef char Vertextype;typedef struct{ Vertextype vexs[maxsize]; 点的值Vertextype GetValue(Graph *g,int
实验效果
方法一:#include#include#define Maxsize 100typedef
实验内容1.初始化链队列2.判断队列是否为空3.元素x进队列4.出队
运行结果如下:
#include#include#define Maxsize 100typedef char dataType;struct TreeNode{ dataType data; TreeNod
#include#include#define Maxsize 100typedef int dataType ;typedef struct { dataType data[Maxsize]; int fr *)malloc(sizeof
Copyright © 2005-2024 51CTO.COM 版权所有 京ICP证060544号