- 博客(2)
- 收藏
- 关注
原创 2021-04-15
最简单的冒泡排序优化 #include<stdio.h> int bubble(int a[],int n){ int flag=1; int i=0,j=0; for(i=0;i<n-1;i++){ flag = 0; //设置一个标志, for(j=0;j<n-1-i;j++){ int temp; if(a[j+1]<a[j]){ temp = a[j]; a[j] = a[j+1]; a[j+1] = temp
2021-04-15 20:00:39 45 1
原创 初识数据结构
初识数据结构 ##顺序栈的基本操作 //结构体定义栈 typedef char ElemType; typedef struct{ ElemType *base; ElemType *top; int stacksize; }sqstack; //初始化栈 void Initstack(sqstack *s){ s->base = (ElemType *)malloc(MAXSIZE *sizeof(ElemType)); //申请动态空间 if( !s->base) {
2021-04-03 16:34:34 46
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人