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--; |
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 bubblesort(int array[],int n){ | |
int i; | |
for(i=n-1;i!=0;i--){ | |
int index; | |
for(index = 0; index < i ;index++){ | |
if(array[index] > array[index+1]){ | |
int n = array[index]; | |
array[index] = array[index+1]; |
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> | |
#include<stdlib.h> | |
#include<ctype.h> | |
#include<sys/types.h> | |
#include<sys/stat.h> | |
typedef struct { | |
char name[200]; | |
char artist[200]; |
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<stdlib.h> | |
void disp(int ary[],int w,int h){ | |
int i,j; | |
for(i=1;i<w-1;i++){ | |
for(j=1;j<h-1;j++){ | |
switch(ary[i*w + j]){ | |
case 0:printf("#");break; | |
case 1:printf(".");break; |
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 matplotlib.pyplot as plt | |
import random | |
a1 = 1.0 | |
a2 = 4.0 | |
xs = [] | |
a = [] | |
for i in range(100000): | |
an = a1 + (a2 - a1) * float(i) / 100000 |