Skip to content

Instantly share code, notes, and snippets.

@ruanchao
ruanchao / intersection.c
Created September 4, 2012 03:41 — forked from shihongzhi/intersection.c
求交集
//answer to google 2011 school interview at zju
int quick_partition(int array[], int start, int end)
{
int x = array[end];
int i = start - 1;
int tmp;
for (int j=start; j<end; ++j)
{
if (array[j]<=x)
{
@ruanchao
ruanchao / compel.go
Created November 21, 2012 07:27
Go-float compels
import "math"
//p为用户自定义的比较精度,比如0.00001
func IsEqual(f1,f2,p float64) bool{
return math.Fdim(f1,f2) < p
}