This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "math" | |
//p为用户自定义的比较精度,比如0.00001 | |
func IsEqual(f1,f2,p float64) bool{ | |
return math.Fdim(f1,f2) < p | |
} |
OlderNewer