排序算法实现
逢歌~
这个作者很懒,什么都没留下…
展开
-
堆排序算法实现
#include <stdio.h>#include <stdlib.h>#include <windows.h>void swap(int *arr,int a,int b){ int temp=arr[a]; arr[a]=arr[b]; arr[b]=temp;}//按大小调整父子节点位置void adjustDown(int *arr,...原创 2018-05-09 16:45:02 · 162 阅读 · 0 评论 -
插入排序算法实现
#include <stdio.h>#include <stdlib.h>#include <windows.h>void insertSort(int *a,int n){ int i; for(i=1;i<n;i++){ int j=i-1; int tmp=a[i]; //取出待插入元素 whil...原创 2018-05-09 17:31:49 · 223 阅读 · 0 评论 -
归并排序算法实现
#include <stdio.h>#include <stdlib.h>//合并有序数组void mergeArray(int *a,int first,int mid,int last,int *temp){ int i=first; int j=mid+1; int m=mid;int n=last; int k=0; while(i&l...原创 2018-05-08 15:41:13 · 120 阅读 · 0 评论