本文译自How to sort NSArray with custom
objects。我们开发的每个程序都会使用到一些数据,而这些数据一般被封装在一个自定义的类中。例如一个音乐程序可能会有一个Song类,聊天程序则又一个Friend类,点菜程序会有一个Recipe类等。有时候我们希望在程序中显示的...
分类:
其他好文 时间:
2014-06-29 15:29:25
阅读次数:
342
一、if判断数字: $A=12 $B=15 if(("$A"<"$B"))
if(("$A"=="$B"))字符串: $A="HELLO" $B="WORLD" if [ "$A" = "FACT_LOGIN_USER" ] if [
"$A" = "$B" ]PS:字符串比较的时候...
分类:
其他好文 时间:
2014-05-28 09:32:44
阅读次数:
347
public class BubbleSortLib { public int[]
Sort(int[] arr) { for (int outer = arr.Length - 1; outer...
分类:
其他好文 时间:
2014-05-28 03:12:37
阅读次数:
223
STL的堆操作STL里面的堆操作一般用到的只有4个:make_heap();、pop_heap();、push_heap();、sort_heap();他们的头文件函数是#include
首先是make_heap();他的函数原型是:void make_heap(first_pointer,end_...
分类:
其他好文 时间:
2014-05-28 02:15:50
阅读次数:
291
Java的Arrays类中有一个sort()方法,该方法是Arrays类的静态方法,在需要对数组进行排序时,非常的好用。但是sort()的参数有好几种,下面我就为大家一一介绍,这几种形式的用法。=====================================================...
分类:
编程语言 时间:
2014-05-26 01:30:26
阅读次数:
398
为什么需要lambda函数
匿名函数是许多编程语言都支持的概念,有函数体,没有函数名。1958年,lisp首先采用匿名函数,匿名函数最常用的是作为回调函数的值。正因为有这样的需求,c++引入了lambda 函数,你可以在你的源码中内联一个lambda函数,这就使得创建快速的,一次性的函数变得简单了。例如,你可以把lambda函数可在参数中传递给std::sort函数
#include ...
分类:
编程语言 时间:
2014-05-25 21:35:27
阅读次数:
377
/*自我修改* Note: 堆排序(Heap Sort)*/#include using
namespace std;// 输出当前堆的排序状况void PrintArray(int data[], int size){ for (int i=1;
i a[i]) // 符号修改后形成...
分类:
其他好文 时间:
2014-05-25 19:07:25
阅读次数:
227
1.php注释://单行注释,/* */多行注释,/** *
*/文档注释。2.复习:字符串+数字=数字array_shift;数组的第一个,array_pop;数组的最后一个,array_push;数组添加。数组:array_sort:数组的值按升序排列,array_arsort:数组的值按降序排...
分类:
其他好文 时间:
2014-05-25 18:53:22
阅读次数:
237
寻找图中最小连通的路径,图如下:
算法步骤:
1. Sort all the edges in non-decreasing order of their weight.
2. Pick the smallest edge. Check if it forms a cycle with the spanning tree
formed so far. If cycle is n...
分类:
其他好文 时间:
2014-05-25 07:35:59
阅读次数:
301