快速排序(n*lgn 不稳定):数组中随机选取一个数x(这里选择最后一个),将数组按比x大的和x小的分成两部分,再对剩余两部分重复这个算法直到结束。def quick_sort(a) (x = a.pop) ? quick_sort(a.select{|i| i x}) : []end冒泡排序(.....
分类:
编程语言 时间:
2015-06-18 23:57:52
阅读次数:
380
1 program hehe; 2 type 3 shu=record 4 l,r,w,h,y,s:longint; 5 end; 6 var 7 n,i,j,k,t,ans,root,size:longint; 8 x:array[0..100000] of shu; 9 10 ...
分类:
其他好文 时间:
2015-06-18 19:42:50
阅读次数:
107
一、表遍历通过ets:first/1获取表的第一个关键字,表中下一个关键字用ets:next/2得到,直到ets:next/2返回'$end_of_table'当多几个进程并发访问ets表时,可以使用ets:safe_fixtable/2函数来保证,每个元素只被访问一次。二、提取表信息,匹配matc...
分类:
其他好文 时间:
2015-06-18 18:55:03
阅读次数:
197
一、关键字说明1.@synthesize关键字:根据@property设置,自动生成成员变量相应的存取方法,从而可以使用点操作符来方便的存取该成员变量。2.@implementation关键字:表明类的实现@end结束3.self关键字:类似于java中的this,是隐藏参数,指向当前调用方法的类。...
分类:
移动开发 时间:
2015-06-18 18:46:08
阅读次数:
136
super在Objective-C中,如果我们需要在类的方法中调用父类的方法时,通常都会用到super,如下所示:@interface MyViewController: UIViewController @end @implementation MyViewController - (void)v...
分类:
其他好文 时间:
2015-06-18 17:06:12
阅读次数:
107
java 先extends 继承类,再implements 继承接口1 public class DataBase extends ClassBase implements Ijiekou {2 3 }// end
分类:
编程语言 时间:
2015-06-18 16:36:24
阅读次数:
115
#include "stdafx.h"#include using namespace std;int RandomInRange(int start,int end);void Swap(int *p,int *q);int patition(int data[],int length,int s...
分类:
编程语言 时间:
2015-06-18 15:19:51
阅读次数:
117
#import@interfaceSemicircleView:UIView/***传入数值(改变圆角位置)**@paramindex0:下,1:上,2,上下,3无*/-(void)upOrdownsemicirc:(NSInteger)index;@end #import"semicircleVi...
分类:
其他好文 时间:
2015-06-18 15:06:46
阅读次数:
89
- (id)initWithTitle:(NSString *)title
message:(NSString *)message
completionBlock:(void (^)(NSUInteger buttonIndex, EMAlertView *alertView))block
cancelButtonTitle:(NSString *)can...
分类:
移动开发 时间:
2015-06-18 11:40:52
阅读次数:
245
1. sliceArray.slice(start,end) 方法可从已有的数组中返回选定的元素start 为起始下标end 为结束下标(可为空,为空时默认结束下标为数组的长度)注意:此方法不会修改原有数组var arr = [1,2,3], brr = arr.slice(0,1);ale...
分类:
编程语言 时间:
2015-06-18 11:25:48
阅读次数:
122