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
package main | |
import ( | |
"fmt" | |
) | |
func main() { | |
sum := 0 | |
for i := 0; i < 10; i++ { | |
sum += i |
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
package main | |
import ( | |
"fmt" | |
) | |
func Sqrt(x float64) float64 { | |
var z float64 = 10 | |
for i := 0; i < 10; i++ { | |
z = z - (z*z-x)/(2*z) |
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
package main | |
import ( | |
"code.google.com/p/go-tour/wc" | |
"strings" | |
) | |
func WordCount(s string) map[string]int { | |
words := strings.Split(s, " ") |
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 scipy.integrate | |
import numpy as np | |
import matplotlib.pyplot as plt | |
def allee(x,t,r,a,k): | |
return r*x*(x-a)*(1.0 - x/k) | |
x0 = 18 |
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
#include<stdio.h> | |
void hanoi(int n,char a,char b,char c){ | |
if(n>0){ | |
hanoi(n-1,a,b,c); | |
printf("一番上を%cから%cに移動\n",a,b); | |
hanoi(n-1,b,c,a); | |
} | |
} |
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
#include<stdio.h> | |
#include<string.h> | |
int min(int a, int b) { | |
return a<b?a:b; | |
} | |
int levenshtein(char *str1,char *str2){ | |
int str1len = strlen(str1); |
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
#include<stdio.h> | |
int Partition(int A[],int left,int right){ | |
int x = A[left]; | |
int i = left; | |
int j; | |
for(j=left+1;j<=right;j++){ | |
if(A[j] < x ){ | |
i++; | |
int buf = A[i]; |
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
#include<stdio.h> | |
int temp[100]; | |
void msort(int A[],int left,int right){ | |
if(left >= right){ | |
return; | |
}else{ | |
int middle = (left+right)/2; | |
msort(A,left,middle); | |
msort(A,middle+1,right); |
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 scipy.integrate | |
import numpy as np | |
import matplotlib.pyplot as plt | |
x01 = [0.2] | |
x10 = [0.2] | |
x20 = [0.2] | |
x25 = [0.2] | |
x30 = [0.2] |
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
#include<stdio.h> | |
void insertionsort(int array[],int n){ | |
int i; | |
for(i=1;i<n;i++){ | |
int k = array[i]; | |
int j = i -1; | |
while((j>=0)&&(array[j] > k)){ | |
array[j+1] = array[j]; | |
j--; |