算法
vijay00
努力,执着
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
简单的C语言归并排序实现代码
/************************************************************************//* 归并排序 2014-9-30 *//***************************************************原创 2014-09-30 09:20:37 · 1487 阅读 · 0 评论 -
简单的C语言选择排序实现代码
#include typedef int elemType;void selectSort(elemType *arr,int arrLength){int index=0;elemType currentMin;int positionOfMin;int i;elemType tempval;if (NULL == arr) retur原创 2014-10-02 10:51:27 · 2807 阅读 · 0 评论 -
简单的C语言插入排序实现代码
#include #include typedef int elemType;void insertSort(elemType *arr,int arrSize){assert(arr);int i,j,k;elemType tempval;for (i=0;i{j=i-1;k=0;tempval = arr[i];while(j原创 2014-10-02 11:21:42 · 908 阅读 · 0 评论 -
简单的C语言赫夫曼树实现代码
结果:#include #include #include #include #define NODEMAXSIZE 30typedef int ElemType;typedef struct Node{struct Node *left,*rigth,*parent;ElemType e;int weight;}HfmN原创 2014-10-05 11:08:52 · 1016 阅读 · 0 评论 -
三种方式求最大公约数
1.更相减损法2.辗转相除法3.遍历#include #include void swapint(int*n, int*m){ int temp = 0; temp = *n; *n=*m; *m=temp;}int getgcd1(int m, int n){ int i = 0; while( m%2 == 0 && n%2 == 0) { ++原创 2016-03-30 15:41:03 · 589 阅读 · 0 评论
分享