1 import "strconv" 2 3 func IsLeapYear(y string)
bool { //y == 2000, 2004 4 //判断是否为闰年 5 year, _ := strconv.Atoi(y) 6 if year%4 ==
0 && y...
分类:
其他好文 时间:
2014-05-26 15:12:52
阅读次数:
230
今天有个需求,要做个排行榜。后台Json传过来,坑爹的是要在前台排序。心想,排序还不简单,什么折半冒泡之类的。代码如下:var userList =
json....//外层循环,共要进行arr.length次求最大值操作 for(var i=0;i<arr.length;i++){ ...
分类:
Web程序 时间:
2014-05-26 14:53:38
阅读次数:
250
无聊写了个单链表排序,不是很难。但是插入写起来很麻烦,都没有,本文全部是将链表中节点值互换,不改变结构,所以很容易写出来 #includeusing
namespace std;struct node{ int n; struct node* next;};//创建链表void swap(int
&...
分类:
其他好文 时间:
2014-05-26 14:52:14
阅读次数:
227
1.冒泡排序法
它重复地走访过要排序的数列,一次比较两个元素,如果他们的顺序错误就把他们交换过来。走访数列的工作是重复地进行直到没有再需要交换,也就是说该数列已经排序完成。
这个算法的名字由来是因为越大的元素会经由交换慢慢“浮”到数列的顶端,故名。 由于冒泡排序简洁的特点,它通常被用来对于...
分类:
其他好文 时间:
2014-05-26 14:23:46
阅读次数:
428
TM,技术手册(Technical Manual);商标(trademark)
分类:
其他好文 时间:
2014-05-26 13:50:23
阅读次数:
265
1、插入排序:插入法是一种比较直观的排序方法。它首先把数组头两个元素排好序,再依次把后面的元素插入适当的位置。把数组元素插完也就完成了排序。代码如下:#includevoid
main(){int a[10];int i,j,k;printf("请输入10个数字!空格隔开\n");for(i=0;i...
分类:
编程语言 时间:
2014-05-26 11:45:36
阅读次数:
344
#includeusing namespace std;///算法重要,但是思想更重要 void
MemeryArray(int a[],int n,int b[],int m,int c[])///经典框架,be careful!{ int i,j,k;
i = j = k = 0; while(...
分类:
其他好文 时间:
2014-05-26 11:22:57
阅读次数:
204
Here are some tips to guide you while shopping
discount LV bags online. Look at the rack bag. Before you go out and buy
handbags online, it is good to...
分类:
其他好文 时间:
2014-05-26 10:26:29
阅读次数:
279
#include#include#includeusing namespace std; //void
MinHeapFixup(int a[], int i)//{// int j ,temp;// temp = a[i];// j = (i-1)/2;//
while(j >= 0 && i !...
分类:
其他好文 时间:
2014-05-26 10:26:08
阅读次数:
212
qsort直接排序。 1 #include 2 #include 3 #include 4 5
#define MAXNUM 1000 6 7 typedef struct { 8 int index; 9 double statis;10 }
node_st;11 12 ...
分类:
其他好文 时间:
2014-05-26 10:05:44
阅读次数:
229