Skip to content

Instantly share code, notes, and snippets.

View pi8027's full-sized avatar

Kazuhiko Sakaguchi pi8027

View GitHub Profile
#include <stdio.h>
#define binary_to_gray_code(binary) ((binary)^(binary)>>1)
int fputb(unsigned int input,unsigned int digit,FILE *output)
{
if(digit){
fputb(input>>1,digit-1,output);
fputc('0'+(input&1),stdout);
#include <stdio.h>
#include <stdlib.h>
static int mergesort_(void *base,const size_t num,const size_t size
,int (*compare)(const void *,const void *),int *temp)
{
size_t counter_a = 0,counter_b = 0;
if(size != 1){
mergesort_(array,size>>1,temp);
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <list>
#include <vector>
template <typename Type>
static int quicksort_compare(Type a,Type b)
{
#include <stdio.h>
#include <stddef.h>
#define GENERATE_SORTING_FUNCTION(function_name,data_type) \
void function_name(data_type *base \
,const size_t size,int (*compare)(const data_type,const data_type)) \
{ \
size_t pivot_pos = 0,first2last = 0,last2first = size-1; \
data_type temp,pivot; \
/*
urn:isbn: なリンクを Amazon.co.jp へのリンクに変換するスクリプト
*/
document.addEventListener('DOMContentLoaded',isbn2amazon,false);
function isbn2amazon()
{
var links = document.getElementsByTagName('a');
/*
quicksort - C
*/
#include <alloca.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
{-
sample
*Main> interactiveParser
a b c
d
e
f g
h
import Data.List
data RationalNum = RationalNum Int Int
data Expr = NumExpr Int
| OpExpr String Expr Expr
instance Show Expr where
show (NumExpr a) = show a
%!PS-Adobe-2.0 EPSF-2.0
/nextpos {
3 index 2 index add 2 div
3 index 2 index sub 12 sqrt div sub
4 index 3 index sub 12 sqrt div
4 index 3 index add 2 div add
mark 7 3 roll cleartomark
} def
%!PS-Adobe-3.0
%%BoundingBox: 0 0 595.28 841.89
gsave
/xsize 3 def
/ysize 6 def
/ruledLine {
/ysize exch def