Skip to content

Instantly share code, notes, and snippets.

View y-yu's full-sized avatar

YOSHIMURA Yuu y-yu

View GitHub Profile
@y-yu
y-yu / gist:4063611
Created November 13, 2012 02:31
echo
$ echo $PATH | tr : '\n' | sort
/bin
/home/ugrad/11/s1111411/perl5/perlbrew/bin
/home/ugrad/11/s1111411/perl5/perlbrew/perls/perl-5.14.1/bin
/opt/local/bin
/sbin
/usr/X11/bin
/usr/bin
/usr/local/bin
/usr/local3/bin
@y-yu
y-yu / 2.ml
Created November 19, 2012 11:08
2.ml
let diff l1 l2 =
List.filter (fun e -> List.fold_left (fun x y -> y != e && x) true l2) l1;;
@y-yu
y-yu / 3.ml
Created November 19, 2012 11:47
3.ml
type 'a tree = Lf | Br of 'a * 'a tree * 'a tree;;
let rec height t =
match t with
Lf -> 1
| Br (_, t1, t2) ->
if (height t1) > (height t2) then
1 + (height t1)
else
1 + (height t2);;
@y-yu
y-yu / 5.txt
Created November 19, 2012 12:04
5.txt
inorder (reflect t) = rev (inorder t) について
(i) t = Lf の時、成り立つことを示せばよい。
<左辺> = inorder (reflect Lf)
= inorder Lf reflectの定義より
= [] inorderの定義より
<右辺> = rev (inorder Lf)
= rev Lf inorderの定義より
@y-yu
y-yu / 7-1.c
Created November 20, 2012 11:17
7-1
#include <stdio.h>
void plus_minus (int *a, int *b) {
int a_ori = *a,
b_ori = *b;
*a = a_ori + b_ori;
*b = a_ori - b_ori;
}
@y-yu
y-yu / 7-2.c
Created November 20, 2012 11:23
7-2
#include <stdio.h>
void swap_array (int a[], int i, int j) {
int t = a[i];
a[i] = a[j];
a[j] = t;
}
int main () {
@y-yu
y-yu / 7-3.c
Created November 20, 2012 11:28
7-3
#include <stdio.h>
float sum_array (float array[], int n) {
float a = 0.0;
int i;
for (i=0; i<n; i++)
a += array[i];
return a;
@y-yu
y-yu / taple.tex
Last active December 10, 2015 19:28
\documentclass{jarticle}
\makeatletter
\def\tuple#1{%
\begingroup
\newcount\@fuck@i
\newcount\@fuck@ii
\@fuck@i = -1
\@fuck@ii = 0
@y-yu
y-yu / 7.1.c
Created January 13, 2013 13:41
#include <stdio.h>
void plus_minus(int *a, int *b)
{
int t1 = *a,
t2 = *b;
*a = t1 + t2;
*b = t1 - t2;
}
@y-yu
y-yu / 7-2.c
Last active December 11, 2015 01:29
#include <stdio.h>
void swap_array(int a[], int x, int y)
{
int t = a[x];
a[x] = a[y];
a[y] = t;
}