自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(13)
  • 收藏
  • 关注

原创 随机产生n个数,生成哈希表,用线性探测解决冲突,验证数组的正确性并计算查找成功时的ASL

#include<stdio.h>#include<time.h> #include<stdlib.h>#include<math.h>int a[1000]={0};//全局数组初始化为0 enum EntryType{Legitimate,Empty,Deleted};struct HashEntry{ int Data; enum EntryType Info;};struct HashTable{ int TableSize.

2021-12-07 15:10:26 300

原创 折半插入排序C语言实现

折半插入排序的原理如上图代码如下:#include<stdio.h>//折半插入排序 void zhebaninsertsort(int a[],int n){ int i,p; int temp; for(p=1;p<n;p++){ temp=a[p]; int low=0; int high=p-1; int mid; while(low<=high) { mid=(l...

2021-12-07 14:39:45 2435

原创 堆排序的C语言实现

#include<stdio.h>//堆排序 #define leftchild(i) (2*i+1)void percdown(int a[],int i,int n){ int child; int temp; for(temp=a[i];leftchild(i)<n;i=child){ child=leftchild(i); if(child!=n-1&&a[child+1]>a[child]) child++; if(temp&l.

2021-12-07 12:50:12 809

原创 希尔排序的C语言实现

#include<stdio.h>void sellsort(int a[],int n){ int i,j,increment; int temp; for(increment=n/2;increment>0;increment/=2){ for(i=increment;i<n;i++){ temp=a[i]; for(j=i;j>=increment;j-=increment){ if(temp<a[j-increment]) .

2021-12-06 13:10:27 515

原创 循环队列的C语言

#include<stdio.h>#include<stdlib.h>struct Queue { int * Data; // 动态分配存储空间 int Front; // 队头 int Rear; // 队尾 int Size; // 队列中元素个数 int MaxSize; // 队列最大容量};void Push(struct Queue*Q,int x){ if(Q->Size==Q->MaxSize){ printf("该队列为满\n.

2021-12-06 12:39:15 92

原创 插入排序的C语言实现

#include<stdio.h>//插入排序 void insertsort(int a[],int n){ int i,p; int temp; for(p=1;p<n;p++){ temp=a[p]; for(i=p;i>0&&a[i-1]>temp;i--){ a[i]=a[i-1]; } a[i]=temp; } }int main(){ int n; scanf("%d",&n); int.

2021-12-06 12:27:02 602

原创 冒泡排序的flag比较

#include<stdio.h>//冒泡排序有flag的使用 void bubblesort(int a[],int n){ int i,j,temp,flag; for(i=0;i<n-1;i++){ flag=0;//flag用来判断这一趟是否有交换 for(j=0;j<n-i-1;j++){ if(a[j]>a[j+1]){ temp=a[j]; a[j]=a[j+1]; a[j+1]=temp; flag=1;.

2021-12-06 11:19:57 479

原创 有序数列的折半查找法

#include<stdio.h>//折半查找法 int zheban(int a[],int n,int m){ int low=0; int high=n-1; int mid; while(low<=high) { mid=(low+high)/2; if(a[mid]==m) return mid;//找到,返回下标 else if(a[mid]<m) low=mid+1; else high=low-1; } return -.

2021-12-05 19:18:00 443

原创 随机生成n个数的二叉平衡树和AVL树,比较两棵树的结点数,结点层次之和,ASL

#include<stdio.h>#include<stdlib.h>#include<time.h> struct TreeNode { int Data; int Height; struct TreeNode * Left; struct TreeNode * Right;};struct AVLNode{ int Data; int Height; struct AVLNode * Left.

2021-12-05 19:15:33 580

原创 输入六个数,输出这六个数的AVL树的先序中序后序

#include<stdio.h>#include<stdlib.h> struct AVLNode{ int Data; int Height; struct AVLNode * Left; struct AVLNode * Right;};int Max(int a,int b){//求最大值,放回树的最大高度 if(a>=b) return a; else return b; }int GetHeight(stru.

2021-12-05 19:11:05 232

原创 1、编写程序,从键盘输入 10 个数据压入栈中,然后从栈中依次弹出这些数据并输出。

#include<stdio.h>#include<stdlib.h>struct Stack{ int * Data; int Top;//top为-1时表示为空栈 int MaxSize;//栈的最大容量 };int pop(struct Stack*L){ if(-1==L->Top) printf("栈为空"); return L->Data[L->Top--];}void push(struct Stack*L,int x).

2021-12-05 19:00:11 757

原创 202009-1 csp 称检测点查询

#include<stdio.h>#include<math.h>int main(){ int n,b,c; scanf("%d%d%d",&n,&b,&c); int a[n][2]; float d[n]; int i,j; int q[n]; float t; int o; for(i=0;i<n;i++) { scanf("%d%d",&a[i][0],&a[i][1]); d[i]=sqrt(

2021-12-04 15:24:57 375

原创 202006-1 csp线性分类器

#include<stdio.h>int main(){ int n,m; scanf("%d %d",&n,&m); int a[n][2]; char c[n]; int b[m][3]; int i,j,sum; char shang,xia; for(i=0;i<n;i++){ scanf("%d %d %c",&a[i][0],&a[i][1],&c[i]); } for(j=0;j<m;j++){

2021-12-04 15:15:59 90

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除