自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(8)
  • 收藏
  • 关注

原创 sort

#include #include #include void print(int x[],int n){ int i; for (i=0;i<n;i++) printf("%d ",x[i]); printf("\n");}void shuffle(int x[],int n){ int i,j,t; for (i=2;i<n;i++) { j = rand()

2014-04-28 16:55:44 337

原创 AVLTree

class MutableAVLTreeMap class Node def self.height node node ? node.height : 0 end def self.insert node, key, value if node.nil? new key, value, nil, nil else case keynode.key

2014-04-24 21:16:31 310

原创 HashMap

class HashMap Entry = Struct.new :key,:value,:next def initialize @table = [nil]*7 @count = 0 end def each for p in @table until p.nil? yield p.key, p.value p = p.next end e

2014-04-07 17:14:13 356 1

原创 Back-Propagation Neural Networks

class BPNN def initialize layers @layers = Array.new layers.size @layers[0] = Array.new layers.first.succ @layers[0][-1] = 1 for i in 1...@layers.size @layers[i] = Array.new layers[i] en

2014-04-06 01:10:54 487

原创 a simple lisp Interpreter

class Parser def initialize code @buf = code @pos = 0 end private def get x = @buf[@pos] @pos += 1 x end def unget @pos -= 1 end def space while true case get when ' ',"\

2014-04-03 15:52:44 458

原创 Generate BrainF**k code

data Node = Move Int | Add Int Int | Loop Int [Node] | Put Int | Get Int deriving (Show,Eq)type Prog = [Node]gen :: [Node] -> [Char]gen x = node x 0 0 where move :: Int -> [Char] move n =

2014-04-03 15:43:11 392

原创 calculate simple expressions

class Calc Token = %r{(((\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?)|[+*/-]|(\s+)|.)} def initialize(expr) @buf = expr.scan(Token).map(&:first).select{|x|x!=~/\s*/} @offset = 0 end

2014-04-03 14:31:18 318

原创 read and write '.bmp' file

class Bitmap FILE_HEADER = "S<L<S<S<L<" INFO_HEADER = "L<l<l<S<S<L<L<l<l<L<L<" BM = 'B'.ord+('M'.ord<<8) CCC = "CCC".freeze attr_reader :width attr_reader :height attr_reader :blob def initial

2014-04-03 13:41:06 483

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除