ohp10.dvi

Size: px
Start display at page:

Download "ohp10.dvi"

Transcription

1

2 ( ) 2

3 2 : def delete if at then (1) EOF (2)@cur 1 (3)@prev 1 : def exch if then return a b c d a.next = b; b.next = c; c.next = = b 4 ( 2 ) a b c 1 : def backward then return a top; a do forward 3

4 2 ( ) : def invert top; if at then return a b a.next while do c = b.next; b.next = a; a = b; b = c = a; (@head ) 1 0 4

5 invert top 1 Buffer class Buffer Cell = Struct.new(:data, :next) def = Cell.new("EOF", = 1 def getlineno def goto(n) top; (n-1).times do forward def at 5

6 4 def = = = 1 def forward if at then = = + 1 def @lineno + 1 def print puts(" " # delete exch backward def backward goto(@lineno - 1) def invert top; if at then return a b a.next while do c = b.next; b.next = a; a = b; b = = a; top 6

7 4 def subst(str) if at then return a = str.split( / = a[2] def read(file) open(file, "r") do f f.each do s insert(s) def save(file) top open(file, "w") do f while not at do f.puts(@cur.data); forward 7

8 4 ( ): def edit e = Buffer.new while true do printf(">") line = gets; c = line[0..0]; s = line[1..-2] if c == "q" then return elsif c == "t" then e.top; e.print elsif c == "p" then e.print; l = e.getlineno; s.to_i.times do e.forward; e.print ; e.goto(l) elsif c == "i" then e.insert(s) elsif c == "r" then e.read(s) elsif c == "w" then e.save(s) elsif c == "s" then e.subst(s); e.print elsif c == "d" then e.delete elsif c == "x" then e.exch elsif c == "b" then e.backward elsif c == "v" then e.invert elsif c == "a" then e.forward; e.insert(s); e.backward elsif c == "c" then e.delete; e.insert(s); e.backward elsif c == "g" then e.goto(s.to_i) else e.forward; e.print 8

9 8 Node Le(<=) if while read print read print class Le < Node def initialize(l, r) = <= def exec() return then 1 else 0 e # Lt(<), Gt(>), Ge(>=), Eq(==), Ne(!=) class If < Node def initialize(l, r) = I def exec() 0 class While < Node def initialize(l, r) = W def exec() 0 class Read < Node def initialize() = R def exec() print > ; return gets.to_i class Print < Node def initialize(l) = P def exec() puts(@left.exec) 9

10 8 def test2 e = Seq.new( Assign.new(Var.new( n ), Read.new), Seq.new( Assign.new(Var.new( i ), Lit.new(2)), While.new( Le.new(Var.new( i ), Var.new( n )), Seq.new( puts(e) Assign.new(Var.new( k ), Lit.new(2)), Seq.new( Assign.new(Var.new( sosu ), Lit.new(1)), Seq.new( While.new( Lt.new(Var.new( k ), Var.new( i )), Seq.new( If.new(Eq.new(Mod.new(Var.new( i ), Var.new( k )), Li Assign.new( sosu, Lit.new(0))), Assign.new(Var.new( k ), Add.new(Var.new( k ), Lit.ne Seq.new( return e.exec If.new(Ne.new(Var.new( sosu ), Lit.new(0)), Print.new( Assign.new(Var.new( i ), Add.new(Var.new( i ), Lit.new 10

11 8 irb> test2 ((n=(r));((i=2);((i<=n)w((k=2);((sosu=1);(((k<i)w((((i%k)==0)i( (k=(k+1))));(((sosu!=0)i(ip));(i=(i+1))))))))) > => nil irb> 11

12 8? Ruby ( ) ( ) ( ) ( 1) 1 def p(x) x* : 1 12

13 (abstract data type ADT) (Ruby ) (stack) LIFO(last-in, first-out) ( ) ( ) / push/pop ( 2 ) push pop top array A B C C B A top: C B A 2: 1 push ( 2 ) top push top pop 1 13

14 Ruby push/pop 1 ( 2 ) : class Stack1 def = = -1 def isempty() < 0 def += = x def pop() -= 1; return x 14

15 : irb> s = Stack1.new... irb> s.push(1) => 1 irb> s.push(2) => 2 irb> s.push(3) => 3 irb> s.isempty => false irb> s.pop => 3 irb> s.pop => 2 irb> s.push(4) => 4 irb> s.push(5) => 5 irb> s.pop => 5 irb> s.pop => 4 irb> s.pop => 1 irb> s.isempty => true 15

16 (queue) ( ) FIFO(fist-in, first-out) ( ) / enq/deq (3 ) enqueue dequeue C D E enq deq array optr top: D E C E D C iptr J I H iptr optr K last top: E D F last 3: iptr optr 2 ( 3 ) (circular buffer) (ring buffer) 16

17 / ipt opt 1 2 last ( 3 ) (top null last ( 1 ) : class Queue1 def = def isempty() <= 0 def = = += 1 def deq() = -= 1; 2 17

18 : irb> q = Queue1.new... irb> q.enq(1) => 1 irb> q.enq(2) => 2 irb> q.isempty => false irb> q.deq => 1 irb> q.enq(3) => 2 irb> q.enq(4) => 3 irb> q.deq => 2 irb> q.deq => 3 irb> q.deq => 4 irb> q.isempty => true 1 18

19 (table) (key) 0 N a[99] = abc... # a[99]... # 99 0 N key kuno saito... val : 2 put get Ruby ( ) def []=(k,v)... k v... def [](k)... k 19

20 (entry) ( 5) ( ) kuno saito hata okano : TableEntry1 = Struct.new(:key, :val) class Table1 def = [] def do e if e.key == k then return e.val return nil def []= do e if e.key == k then e.val = v; v)) 20

21 irb> t1 = Table1.new => irb> t1[ kuno ] = 20 => 20 irb> t1[ okano ] = 44 => 44 irb> t1[ kuno ] => 20 irb> require pp => true irb> pp t1 # pp [#<struct TableEntry1 key="kuno", val=20>, #<struct TableEntry1 key="okano", val=44>]> => nil ( ) (search) (linear search) n O(n) 21

22 2 3 2 (binary search tree) 2 (2 ) ( 6) : 2 ( ) ( ) O(logn) 3 total order 22

23 2 TableEntry2 = Struct.new(:key, :val, :left, :right) class Table2 def = nil def [](k) == nil then return nil == k then > k then else def []=(k,v) == = TableEntry2.new(k,v) == = v > k == nil = = v else == nil = = v nil 23

24 2 nil N 1 N N bench 0 N 1 t = Table1.new # Table2.new Array.new(10000) bench(10000) do x = rand(10000); t[x] = x #1 3 2 ( ) 24

25 Ruby Hash (associative array) Perl JavaScript Python Ruby Perl (hash table) Ruby ( ) Hash.new( ) ( nil) { =>, =>,... } ( ) h = {1 => "abc", 8 => "xyz", 3 => "a"} h = {"abc" => 3, "def" => "u"} h = { } # Hash.new(nil) O(1) 25

26 0 N 1 i = hash( ) hash ( ) 0 N ( 7) hash hash ( ) O(1) saito 30 kuno hash saito hash kuno 20 7: 4 26

27 1 hash ( ) 2 hash (collision) 2 5 ( 50%) 4 ( ) Ruby 5 1 d = hash2( ) d d 27

28 ? ( ) 1 (2 ) 8: ( )

29 Ruby def prepare $graph = Hash.new() cn(" ", " "); cn(" ", " "); cn(" ", " ") cn(" ", " "); cn(" ", " "); cn(" ", " ") cn(" ", " "); cn(" ", " "); cn(" ", " "); cn(" ", " ") cn(" ", " "); cn(" ", " "); cn(" ", " "); cn(" ", " "); cn(" ", " "); cn(" ", " "); cn(" ", " "); cn(" ", " "); cn(" ", " ") Node1 = Struct.new(:name, :arr, :path) def cn(name1, name2) if $graph[name1] == nil then $graph[name1] = Node1.new(name1, if $graph[name2] == nil then $graph[name2] = Node1.new(name2, $graph[name1].arr.push($graph[name2]) $graph[name2].arr.push($graph[name1]) prepare $graph cn arr( ) path nil 29

30 A B ( ) 1 def traverse1(start, goal) s = Stack1.new; n = $graph[start]; n.path = [start]; s.push(n puts("start: #{start}") while!s.isempty do n = s.pop n.arr.each do m if m.path == nil m.path = n.path.dup; m.path.push(m.name) puts("#{m.name}: #{m.path.join(, )}") if m.name == goal then return else s.push(m) 0 1 (path nil ) 7 7 dup join 30

31 def test1 prepare; traverse1(, ) irb> test1 START: :, :, :, :, :,, :,,, => nil 4 ( push/pop enq/deq ) irb> test2 START: :, :, :, :,, :,, :,, :,,, => nil 31

32 ? LIFO 9 (depth first search) FIFO ( ) 9: ( )

33 7 2 A B B 1 B 1 pop A push 1 A 1 pop B push B 1 pop A 1 push 33

34 (context) (state) x + 1 x (state transition) ( ) 34

35 (game) (puzzle) 1 ( ) ( / ) 1 ( ) ( ) (state space search) 35

36 10: ( ) 10 ( ) 9 (1) (2) (3) = / / 2 36

37 ( ): s = ; s.mark; stack.push(s) while!stack.isempty do s = stack.pop (s ) do s1 if s1.isgoal then! elsif!s.ismarked then s1.mark; stack.push(s1)! ( ) mark ismarked 37

38 : 11 11: ( 1 ) (0 9 ) 1 ( ) : $hmax = 3; $vmax = 4; $goalx = 1; $goaly = 3 $hsize = [2, 1, 1, 1, 1, 2, 1, 1, 1, 1] $vsize = [2, 2, 2, 2, 2, 1, 1, 1, 1, 1] $names = Mvvvvwssss. 38

39 : 9 (X Y 9 ) 2 makeboard : def makeboard(x, y) b = Array.new($vmax+1) do Array.new($hmax+1, -1) $hsize.length.times do i $hsize[i].times do j return b $vsize[i].times do k b[y[i]+k][x[i]+j] = i -1( ) 2 39

40 : b i x,y dx,dy movable : def movable(b, i, x, y, dx, dy) if x+dx < 0 x+$hsize[i]-1+dx > $hmax y+dy < 0 y+$vsize[i]-1+dy > $vmax then return false $hsize[i].times do j $vsize[i].times do k p = b[y+dy+k][x+dx+j]; if p!= -1 && p!= i then return false return true NO -1( ) NO OK 1 State 9 XY 1 initailze dup 40

41 : getx gety isgoal 0 move i dx,dy (self ) ( dup ): class State def initialize(x, @prev = p def getx() def gety() def isgoal() == $goalx == $goaly def move(i, dx, dy; s = dy; return s def to_s() s = do a a.each do i s = s + $names[i..i] ; s = s + "\n" return s def output(f) nil f.puts(to_s); f.puts( ) 41

42 : to s makeboard 1 1 output main Ruby x y visited 1 ( ) ( ) : 42

43 : def main x = [1,0,3,0,3,1,0,1,2,3]; y = [0,0,0,2,2,2,4,3,3,4] stack = [State.new(x,y)]; visited = {stack[0].to_s => true} while true do if stack.length == 0 then puts("impossible."); return false s = stack.pop puts(s.to_s); puts( ---- ) if s.isgoal then break # or s = stack.shift x = s.getx; y = s.gety; b = makeboard(x, y) $hsize.length.times do i [[1,0],[-1,0],[0,1],[0,-1]].each do a if movable(b, i, x[i], y[i], a[0], a[1]) s1 = s.move(i, a[0], a[1]); k1 = s1.to_s if visited[k1] == nil then stack.push(s1); visited[k1 File.open( out.data, w ) do f s.output(f) return true out.data : 43

44 : irb> main vmmv vmmv vwwv vssv s..s ---- vmmv vmmv vwwv vssv s.s vmmv vmmv vwwv vssv ss ( ) vvvv vvvv ssww MM.s MM.s ---- vvvv vvvv ssww 44

45 .MMs.MMs ---- => true stack.pop stack.shift ( stack )

46 10A 1. Subject: Report 10A Q1. Q2. Q3. 46

47 10B + Report 10B 47

r10.dvi

r10.dvi 2015 10 2015.12.7 1 ( ) 2 2.1 2 : def delete if at then return @cur = @prev.next = @cur.next (1) EOF (2)@cur 1 (3)@prev 1 : def exch if at @cur.next == @tail then return a = @prev; b = @cur.next; c = @cur;

More information

r9.dvi

r9.dvi 2011 9 2011.12.9 Ruby B Web ( ) 1 1.1 2 def delete if at then return @cur = @prev.next = @cur.next (1) EOF (2)@cur 1 ()@prev 1 def exch if at @cur.next == @tail then return a = @prev; b = @cur.next; c

More information

r1.dvi

r1.dvi Ruby 2009.9.7 1 ( ) --- ( ( ) ( ) 1 --- ( ) 1 ( ) (?) IT 7K( )?? ( ) ( )? IT ( ) --- ( ) 1 ( ) --- ( ) (?) 2-3% Top-Level ICT Professional 5% ICT Professional 10% 100% 50% 20% Devl. Experiment Adv. ICT

More information

( ) ( ) 30 ( ) 27 [1] p LIFO(last in first out, ) (push) (pup) 1

( ) ( ) 30 ( ) 27 [1] p LIFO(last in first out, ) (push) (pup) 1 () 2006 2 27 1 10 23 () 30 () 27 [1] p.97252 7 2 2.1 2.1.1 1 LIFO(last in first out, ) (push) (pup) 1 1: 2.1.2 1 List 4-1(p.100) stack[] stack top 1 2 (push) (pop) 1 2 void stack push(double val) val stack

More information

r03.dvi

r03.dvi 19 ( ) 019.4.0 CS 1 (comand line arguments) Unix./a.out aa bbb ccc ( ) C main void... argc argv argc ( ) argv (C char ) ( 1) argc 4 argv NULL. / a. o u t \0 a a \0 b b b \0 c c c \0 1: // argdemo1.c ---

More information

ohp03.dvi

ohp03.dvi 19 3 ( ) 2019.4.20 CS 1 (comand line arguments) Unix./a.out aa bbb ccc ( ) C main void int main(int argc, char *argv[]) {... 2 (2) argc argv argc ( ) argv (C char ) ( 1) argc 4 argv NULL. / a. o u t \0

More information

parser.y 3. node.rb 4. CD-ROM

parser.y 3. node.rb 4. CD-ROM 1. 1 51 2. parser.y 3. node.rb 4. CD-ROM 1 10 2 i 0 i 10 " i i+1 3 for(i = 0; i

More information

r07.dvi

r07.dvi 19 7 ( ) 2019.4.20 1 1.1 (data structure ( (dynamic data structure 1 malloc C free C (garbage collection GC C GC(conservative GC 2 1.2 data next p 3 5 7 9 p 3 5 7 9 p 3 5 7 9 1 1: (single linked list 1

More information

Ruby Ruby ruby Ruby G: Ruby>ruby Ks sample1.rb G: Ruby> irb (interactive Ruby) G: Ruby>irb -Ks irb(main):001:0> print( ) 44=>

Ruby Ruby ruby Ruby G: Ruby>ruby Ks sample1.rb G: Ruby> irb (interactive Ruby) G: Ruby>irb -Ks irb(main):001:0> print( ) 44=> Ruby Ruby 200779 ruby Ruby G: Ruby>ruby Ks sample1.rb G: Ruby> irb (interactive Ruby) G: Ruby>irb -Ks irb(main):001:0> print( 2+3+4+5+6+7+8+9 ) 44 irb(main):002:0> irb irb(main):001:0> 1+2+3+4 => 10 irb(main):002:0>

More information

ohp07.dvi

ohp07.dvi 19 7 ( ) 2019.4.20 1 (data structure) ( ) (dynamic data structure) 1 malloc C free 1 (static data structure) 2 (2) C (garbage collection GC) C GC(conservative GC) 2 2 conservative GC 3 data next p 3 5

More information

ALG2012-A.ppt

ALG2012-A.ppt 21279 (sakai.keiichi@kochi-tech.ac.jp) http://www.info.kochi-tech.ac.jp/k1sakai/lecture/alg/212/index.html (, )ε m = n C2 = n ( n 1) / 2 m = n ( n 1) 1 11 11 111 11 111 111 1111 1 1 11 1 11 11 111 4-dimentional

More information

ohp08.dvi

ohp08.dvi 19 8 ( ) 2019.4.20 1 (linked list) ( ) next ( 1) (head) (tail) ( ) top head tail head data next 1: 2 (2) NULL nil ( ) NULL ( NULL ) ( 1 ) (double linked list ) ( 2) 3 (3) head cur tail head cur prev data

More information

untitled

untitled 21174 (sakai.keiichi@kochi-tech.ac.jp) http://www.info.kochi-tech.ac.jp/k1sakai/lecture/alg/211/index.html tech.ac.jp/k1sakai/lecture/alg/211/index.html html (, )ε m = n C2 = n ( n 1) / 2 m = n ( ( n

More information

r08.dvi

r08.dvi 19 8 ( ) 019.4.0 1 1.1 (linked list) ( ) next ( 1) (head) (tail) ( ) top head tail head data next 1: NULL nil ( ) NULL ( NULL ) ( 1 ) (double linked list ) ( ) 1 next 1 prev 1 head cur tail head cur prev

More information

untitled

untitled C -1 - -2 - concept lecture keywords FILE, fopen, fclose, fscanf, fprintf, EOF, r w a, typedef gifts.dat Yt JZK-3 Jizake tsumeawase 45 BSP-15 Body soap set 3 BT-2 Bath towel set 25 TEA-2 Koutya

More information

fp.gby

fp.gby 1 1 2 2 3 2 4 5 6 7 8 9 10 11 Haskell 12 13 Haskell 14 15 ( ) 16 ) 30 17 static 18 (IORef) 19 20 OK NG 21 Haskell (+) :: Num a => a -> a -> a sort :: Ord a => [a] -> [a] delete :: Eq a => a -> [a] -> [a]

More information

¥×¥í¥°¥é¥ß¥ó¥°±é½¬I Exercise on Programming I [1zh] ` `%%%`#`&12_`__~~~ alse

¥×¥í¥°¥é¥ß¥ó¥°±é½¬I  Exercise on Programming I [1zh] ` `%%%`#`&12_`__~~~alse I Exercise on Programming I http://bit.ly/oitprog1 1, 2 of 14 ( RD S ) I 1, 2 of 14 1 / 44 Ruby Ruby ( RD S ) I 1, 2 of 14 2 / 44 7 5 9 2 9 3 3 2 6 5 1 3 2 5 6 4 7 8 4 5 2 7 9 6 4 7 1 3 ( RD S ) I 1, 2

More information

3360 druby Web Who is translating it? http://dx.doi.org/10.1007/s10766-008-0086-1 $32.00 International Journal of PARALLEL PROGRAMING Must buy! http://dx.doi.org/10.1007/s10766-008-0086-1 toruby LT Linux

More information

LIFO(last in first out, ) 1 FIFO(first in first out, ) 2 2 PUSH POP : 1

LIFO(last in first out, ) 1 FIFO(first in first out, ) 2 2 PUSH POP : 1 2007 7 17 2 1 1.1 LIFO(last in first out, ) 1 FIFO(first in first out, ) 2 2 PUSH POP 2 2 5 5 5 1: 1 2 データの追加 データの取り出し 5 2 5 2 5 2: 1.2 [1] pp.199 217 2 (binary tree) 2 2.1 (three: ) ( ) 秋田高専 校長 準学士課程学生

More information

Ruby演習テキスト1

Ruby演習テキスト1 Ruby言語 基礎演習 社会人技術者研修 2014年度 テキスト 社会人技術者研修 2014年度テキスト 2014.11 Ruby基礎演習 1 2014.11 2015.2.1 puts "Hello Ruby >ruby hello.rb ( リターン ) > ruby hello.rb Hello Ruby # はじめての ruby プログラム puts "Hello Ruby" > ruby

More information

untitled

untitled 30 callcc yhara ( ( ) (1) callcc (2) callcc (3) callcc callcc Continuation callcc (1) (2) (3) (1) (2) (3) (4) class Foo def f p 1 callcc{ cc return cc} p 2 class Bar def initialize @cc = Foo.new.f def

More information

ohp07.dvi

ohp07.dvi 17 7 (2) 2017.9.13 1 BNF BNF ( ) ( ) 0 ( ) + 1 ( ) ( ) [ ] BNF BNF BNF prog ::= ( stat ) stat ::= ident = expr ; read ident ; print expr ; if ( expr ) stat while ( expr ) stat { prog expr ::= term ( +

More information

untitled

untitled II 4 Yacc Lex 2005 : 0 1 Yacc 20 Lex 1 20 traverse 1 %% 2 [0-9]+ { yylval.val = atoi((char*)yytext); return NUM; 3 "+" { return + ; 4 "*" { return * ; 5 "-" { return - ; 6 "/" { return / ; 7 [ \t] { /*

More information

¥×¥í¥°¥é¥ß¥ó¥°±é½¬I Exercise on Programming I [1zh] ` `%%%`#`&12_`__~~~ alse

¥×¥í¥°¥é¥ß¥ó¥°±é½¬I  Exercise on Programming I [1zh] ` `%%%`#`&12_`__~~~alse I Exercise on Programming I http://bit.ly/oitprog1 12 of 14 ( RD S ) I 12 of 14 1 / 35 https://bit.ly/oitprog1 ( RD S ) I 12 of 14 2 / 35 game.rb ( RD S ) I 12 of 14 3 / 35 game.rb 11 ( ) 1 require "io/console"

More information

Microsoft PowerPoint - 6.pptx

Microsoft PowerPoint - 6.pptx 6. データ構造入門 6-1. 連結リスト (Linked List) 6-2. スタック (Stack) 6-. キュー (Queue) 6-4. デク (Double-Ended-Queue) 6-. 抽象データ型 (Abstract Data Type) データ構造とは データの保存を効率的に行うもの 1 ito 2.712.14 suzuki データ構造 1 2 6-1. 連結リスト (Linked

More information

¥×¥í¥°¥é¥ß¥ó¥°±é½¬I Exercise on Programming I [1zh] ` `%%%`#`&12_`__~~~ alse

¥×¥í¥°¥é¥ß¥ó¥°±é½¬I  Exercise on Programming I [1zh] ` `%%%`#`&12_`__~~~alse I Exercise on Programming I http://bit.ly/oitprog1 13 of 14 ( RD S ) I 13 of 14 1 / 39 https://bit.ly/oitprog1 ( RD S ) I 13 of 14 2 / 39 game.rb ( RD S ) I 13 of 14 3 / 39 game.rb 12 ( ) 1 require "io/console"

More information

Parametric Polymorphism

Parametric Polymorphism ML 2 2011/04/19 Parametric Polymorphism Type Polymorphism ? : val hd_int : int list - > int val hd_bool : bool list - > bool val hd_i_x_b : (int * bool) list - > int * bool etc. let hd_int = function (x

More information

e /5/21( )

e /5/21( ) e05577 008/5/( ) (Depth First Search Tree) 3. node............................ 3. getnodeid getnodename................... 3.3.......................... 4.4................... 5.4. (articulation point)............

More information

Microsoft PowerPoint - 06.pptx

Microsoft PowerPoint - 06.pptx アルゴリズムとデータ構造第 6 回 : 探索問題に対応するデータ構造 (2) 担当 : 上原隆平 (uehara) 2015/04/22 内容 スタック (stack): 最後に追加されたデータが最初に取り出される 待ち行列 / キュー (queue): 最初に追加されたデータが最初に取り出される ヒープ (heap): 蓄えられたデータのうち小さいものから順に取り出される 配列による実装 連結リストによる実装

More information

r2.dvi

r2.dvi 15 2 1 2015.6.2 ( ( ( Ruby ( ( https://www.ruby-lang.org/ja/documentation/ 2 Chris Pine,, 2,, 2010. Yugui, Ruby,, 2008. Ruby 1 ( Ruby ( 2 ( i i j ( ) /( (regular expression Ruby /.../ ( 1 if / / =~ =~

More information

N88 BASIC 0.3 C: My Documents 0.6: 0.3: (R) (G) : enterreturn : (F) BA- SIC.bas 0.8: (V) 0.9: 0.5:

N88 BASIC 0.3 C: My Documents 0.6: 0.3: (R) (G) : enterreturn : (F) BA- SIC.bas 0.8: (V) 0.9: 0.5: BASIC 20 4 10 0 N88 Basic 1 0.0 N88 Basic..................................... 1 0.1............................................... 3 1 4 2 5 3 6 4 7 5 10 6 13 7 14 0 N88 Basic 0.0 N88 Basic 0.1: N88Basic

More information

Emacs Ruby..

Emacs Ruby.. command line editor 27014533 2018 3 1 5 1.1................................... 5 1.2................................... 5 2 6 2.1 Emacs...................................... 6 2.2 Ruby.......................................

More information

Microsoft PowerPoint - ruby_instruction.ppt

Microsoft PowerPoint - ruby_instruction.ppt Ruby 入門 流れ Ruby の文法 画面に出力 キーボードから入力 数値 文字列 変数 配列 ハッシュ 制御構造 ( 分岐 繰り返しなど ) if while case for each 関数 クラス Ruby とは プログラミング言語 インタプリタ言語 オブジェクト指向 国産 ウェブアプリケーションフレームワーク RubyOnRails で注目 弊社での Web アプリケーション開発に利用 画面に出力

More information

Ruby 50 Ruby UTF print, \n [Ruby-1] print("hello, Ruby.\n") [Ruby-2] Hello, Ruby. [Ruby-3] print("hello, \"Ruby\".\n") 2 [Ruby-4] seisuu = 10 pr

Ruby 50 Ruby UTF print, \n [Ruby-1] print(hello, Ruby.\n) [Ruby-2] Hello, Ruby. [Ruby-3] print(hello, \Ruby\.\n) 2 [Ruby-4] seisuu = 10 pr Ruby 50 Ruby UTF-8 1 1 print, \n [Ruby-1] print("hello, Ruby.\n") [Ruby-2] Hello, Ruby. [Ruby-3] print("hello, \"Ruby\".\n") 2 [Ruby-4] seisuu = 10 print(seisuu, "\n") jissuu = 3.141592 print(jissuu, "\n")

More information

10/ / /30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20 6. http, CGI Perl 11/27 7. ( ) Perl 12/ 4 8. Windows Winsock 12/11 9. JAV

10/ / /30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20 6. http, CGI Perl 11/27 7. ( ) Perl 12/ 4 8. Windows Winsock 12/11 9. JAV tutimura@mist.i.u-tokyo.ac.jp kaneko@ipl.t.u-tokyo.ac.jp http://www.misojiro.t.u-tokyo.ac.jp/ tutimura/sem3/ 2002 11 20 p.1/34 10/16 1. 10/23 2. 10/30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20

More information

3 3.1 algebraic datatype data k = 1 1,1... 1,n1 2 2,1... 2,n2... m m,1... m,nm 1 m m m,1,..., m,nm m 1, 2,..., k 1 data Foo x y = Alice x [y] B

3 3.1 algebraic datatype data k = 1 1,1... 1,n1 2 2,1... 2,n2... m m,1... m,nm 1 m m m,1,..., m,nm m 1, 2,..., k 1 data Foo x y = Alice x [y] B 3 3.1 algebraic datatype data 1 2... k = 1 1,1... 1,n1 2 2,1... 2,n2... m m,1... m,nm 1 m m m,1,..., m,nm m 1, 2,..., k 1 data Foo x y = Alice x [y] Bob String y Charlie Foo Double Integer Alice 3.14 [1,2],

More information

I117 II I117 PROGRAMMING PRACTICE II DEBUG Research Center for Advanced Computing Infrastructure (RCACI) / Yasuhiro Ohara

I117 II I117 PROGRAMMING PRACTICE II DEBUG Research Center for Advanced Computing Infrastructure (RCACI) / Yasuhiro Ohara I117 II I117 PROGRAMMING PRACTICE II DEBUG Research Center for Advanced Computing Infrastructure (RCACI) / Yasuhiro Ohara yasu@jaist.ac.jp / SCHEDULE 1. 2011/06/07(Tue) / Basic of Programming 2. 2011/06/09(Thu)

More information

つくって学ぶプログラミング言語 RubyによるScheme処理系の実装

つくって学ぶプログラミング言語 RubyによるScheme処理系の実装 Ruby Scheme 2013-04-16 ( )! SICP *1 ;-) SchemeR SICP MIT * 1 Structure and Interpretaion of Computer Programs 2nd ed.: 2 i SchemeR Ruby Ruby Ruby Ruby & 3.0 Ruby ii https://github.com/ichusrlocalbin/scheme_in_ruby

More information

I 11

I 11 I 11 2 h 345 645 3 var strs = ["meijo", "university", "abc", "shiogama","yagoto", "ueda", "hara", "irinaka", "yagoto-nisseki", "kanayama"] function make_table(){ var a = [] for (var i = 0; i < strs.length;

More information

第2回

第2回 第 4 回基本データ構造 1 明星大学情報学科 2 3 年前期 アルゴリズムとデータ構造 Ⅰ 第 4 回 Page 1 配列 スタック キューとその操作 4-1. 配列とその操作 配列型 同じ型の変数を並べたもの 配列にする型は 基本型 配列型 構造体 ポインタいずれでもよい 要素の並べ方を 次元 という 1 次元配列 ( 直線状 ) 2 次元配列 ( 平面状 ) 3 次元配列 ( 立体状 ) a[5]

More information

r11.dvi

r11.dvi 19 11 ( ) 2019.4.20 1 / 1.1 ( n n O(n 2 O(n 2 ) ( 1 d n 1 n logn O(nlogn n ( n logn C 1.2 ( ( merge 2 1 1 3 1 4 5 4 2 3 7 9 7 1 2 3 4 5 7 9 1: 2 ivec merge int *ivec_new(int size) { int *a = (int*)malloc((size+1)

More information

ohp11.dvi

ohp11.dvi 19 11 ( ) 2019.4.20 1 / ( ) n O(n 2 ) O(n 2 ) ( ) 1 d n 1 n logn O(nlogn) n ( n logn C ) 2 ( ) ( merge) 2 1 1 3 1 4 5 4 2 3 7 9 7 1 2 3 4 5 7 9 1: 2 ivec merge 3 ( ) (2) int *ivec_new(int size) { int *a

More information

cpp1.dvi

cpp1.dvi 2017 c 1 C++ (1) C C++, C++, C 11, 12 13 (1) 14 (2) 11 1 n C++ //, [List 11] 1: #include // C 2: 3: int main(void) { 4: std::cout

More information

Microsoft PowerPoint - 06graph3.ppt [互換モード]

Microsoft PowerPoint - 06graph3.ppt [互換モード] I118 グラフとオートマトン理論 Graphs and Automata 担当 : 上原隆平 (Ryuhei UEHARA) uehara@jaist.ac.jp http://www.jaist.ac.jp/~uehara/ 1/20 6.14 グラフにおける探索木 (Search Tree in a Graph) グラフG=(V,E) における探索アルゴリズム : 1. Q:={v { 0 }

More information

3 Powered by mod_perl, Apache & MySQL use Item; my $item = Item->new( id => 1, name => ' ', price => 1200,

3 Powered by mod_perl, Apache & MySQL use Item; my $item = Item->new( id => 1, name => ' ', price => 1200, WEB DB PRESS Vol.1 79 3 Powered by mod_perl, Apache & MySQL use Item; my $item = Item->new( id => 1, name => ' ', price => 1200, http://www.postgresql.org/http://www.jp.postgresql.org/ 80 WEB DB PRESS

More information

JavaScript 1.! DOM Ajax Shelley Powers,, JavaScript David Flanagan, JavaScript 2

JavaScript 1.! DOM Ajax Shelley Powers,, JavaScript David Flanagan, JavaScript 2 JavaScript (2) 1 JavaScript 1.! 1. 2. 3. DOM 4. 2. 3. Ajax Shelley Powers,, JavaScript David Flanagan, JavaScript 2 (1) var a; a = 8; a = 3 + 4; a = 8 3; a = 8 * 2; a = 8 / 2; a = 8 % 3; 1 a++; ++a; (++

More information

¥¤¥ó¥¿¡¼¥Í¥Ã¥È·×¬¤È¥Ç¡¼¥¿²òÀÏ Âè5²ó

¥¤¥ó¥¿¡¼¥Í¥Ã¥È·×¬¤È¥Ç¡¼¥¿²òÀÏ Âè5²ó 5 2011 6 8 : 1 2 / 31 : 3 / 31 ARPANET in 1969 4 / 31 4 ARPANET ARPANET in 1973 5 / 31 lumeta internet mapping http://www.lumeta.com http://www.cheswick.com/ches/map/ 6 / 31 IP 7 / 31 ( ) (L3) : : 7 Application

More information

MCMD Ruby Package Documentation NYSOL : Ver. 1.0 revise history: March 10, 2014 : nysol November 2, 2013 : first release 2014 3 10 Copyright c 2013 by NYSOL CORPORATION 3 1 5 1.1.....................................................

More information

( ) ( ) lex LL(1) LL(1)

( ) ( ) lex LL(1) LL(1) () () lex LL(1) LL(1) http://www.cs.info.mie-u.ac.jp/~toshi/lectures/compiler/ 29 5 14 1 1 () / (front end) (back end) (phase) (pass) 1 2 1 () () var left, right; fun int main() { left = 0; right = 10;

More information

/ SCHEDULE /06/07(Tue) / Basic of Programming /06/09(Thu) / Fundamental structures /06/14(Tue) / Memory Management /06/1

/ SCHEDULE /06/07(Tue) / Basic of Programming /06/09(Thu) / Fundamental structures /06/14(Tue) / Memory Management /06/1 I117 II I117 PROGRAMMING PRACTICE II 2 MEMORY MANAGEMENT 2 Research Center for Advanced Computing Infrastructure (RCACI) / Yasuhiro Ohara yasu@jaist.ac.jp / SCHEDULE 1. 2011/06/07(Tue) / Basic of Programming

More information

Boo Boo 2 Boo 2.NET Framework SDK 2 Subversion 2 2 Java 4 NAnt 5 Boo 5 5 Boo if 11 for 11 range 12 break continue 13 pass

Boo Boo 2 Boo 2.NET Framework SDK 2 Subversion 2 2 Java 4 NAnt 5 Boo 5 5 Boo if 11 for 11 range 12 break continue 13 pass Boo Boo 2 Boo 2.NET Framework SDK 2 Subversion 2 2 Java 4 NAnt 5 Boo 5 5 Boo 6 6 7 9 10 11 if 11 for 11 range 12 break continue 13 pass 13 13 14 15 15 23 23 24 24 24 25 import 26 27-1- Boo Boo Python CLI.NET

More information

3360 druby Web Who is translating it? http://dx.doi.org/10.1007/s10766-008-0086-1 $32.00 International Journal of PARALLEL PROGRAMING Must buy! http://dx.doi.org/10.1007/s10766-008-0086-1 toruby The

More information

(CC Attribution) Lisp 2.1 (Gauche )

(CC Attribution) Lisp 2.1 (Gauche ) http://www.flickr.com/photos/dust/3603580129/ (CC Attribution) Lisp 2.1 (Gauche ) 2 2000EY-Office 3 4 Lisp 5 New York The lisps Sammy Tunis flickr lisp http://www.flickr.com/photos/dust/3603580129/ (CC

More information

RubyKaigi2009 COBOL

RubyKaigi2009 COBOL RubyKaigi2009 COBOL seki@druby.org 3360 Pragmatic Bookshelf druby Web $32.00 International Journal of PARALLEL PROGRAMING !? MapReduce Rinda (map, reduce) map reduce key value [, ] [, ID] map()

More information

lexex.dvi

lexex.dvi (2018, c ) http://istksckwanseiacjp/ ishiura/cpl/ 4 41 1 mini-c lexc,, 2 testlexc, lexc mini-c 1 ( ) mini-c ( ) (int, char, if, else, while, return 6 ) ( ) (+, -, *, /, %, &, =, ==,!=, >, >=,

More information

AC-1 procedure AC-1 (G) begin Q = f(i; j) (i; j) 2 arc(g), i 6= jg repeat begin CHANGE = false for each (i; j) 2 Q do CHANGE = REVISE((i; j)) _ CHANGE

AC-1 procedure AC-1 (G) begin Q = f(i; j) (i; j) 2 arc(g), i 6= jg repeat begin CHANGE = false for each (i; j) 2 Q do CHANGE = REVISE((i; j)) _ CHANGE AC-5, May 7, 2003 Lecture 3-1, (Local Consistency) 4 1. (Node Consistency) 2. (Arc Consistency) 3. (Path Consistency) m (m-consistency) 4. AC-1 AC-2 (Waltz, ) AC-3 AC-4 AC-1 procedure AC-1 (G) begin Q

More information

(search: ) [1] ( ) 2 (linear search) (sequential search) 1

(search: ) [1] ( ) 2 (linear search) (sequential search) 1 2005 11 14 1 1.1 2 1.2 (search:) [1] () 2 (linear search) (sequential search) 1 2.1 2.1.1 List 2-1(p.37) 1 1 13 n

More information

23 Study on Generation of Sudoku Problems with Fewer Clues

23 Study on Generation of Sudoku Problems with Fewer Clues 23 Study on Generation of Sudoku Problems with Fewer Clues 1120254 2012 3 1 9 9 21 18 i Abstract Study on Generation of Sudoku Problems with Fewer Clues Norimasa NASU Sudoku is puzzle a kind of pencil

More information

haskell.gby

haskell.gby Haskell 1 2 3 Haskell ( ) 4 Haskell Lisper 5 Haskell = Haskell 6 Haskell Haskell... 7 qsort [8,2,5,1] [1,2,5,8] "Hello, " ++ "world!" "Hello, world!" 1 + 2 div 8 2 (+) 1 2 8 div 2 3 4 map even [1,2,3,4]

More information

unix15-script2_09.key

unix15-script2_09.key UNIX講習会 シェルスクリプト2 31/July/2015 情報管理解析室 西出 浩世 SGE ~/unix15/sge $ cd ~/unix15/sge $ ls script* script2.sh script3.sh script4.sh ~/unix15/sge/results sam 12 $ ls results/*.sam $ rm -r results $ cp -r /usr/local/data/unix15/sge/results.

More information

Microsoft PowerPoint - 13Kadai.pptx

Microsoft PowerPoint - 13Kadai.pptx 提出 講義での説明を聞いて下さい 櫻井彰人 コンパイラ理論課題 締め切りは 8 月 1 日とします 順不同で できるものをできるだけ多く回答して下さい 電子メールで sakurai あっと ae どっと keio どっと ac どっと jp に送ってください ファイル形式は pdf か MsWord で ただし プログラムはテキストファイルで レポート課題 1 それぞれ 1 問として考えます 電卓

More information

PowerPoint Template

PowerPoint Template プログラミング演習 Ⅲ Linked List P. Ravindra S. De Silva e-mail: ravi@cs.tut.ac.jp, Room F-413 URL: www.icd.cs.tut.ac.jp/~ravi/prog3/index_j.html 連結リストとは? 一つひとつの要素がその前後の要素との参照関係をもつデータ構造 A B C D 連結リストを使用する利点 - 通常の配列はサイズが固定されている

More information

離散数学

離散数学 離散数学 グラフ探索アルゴリズム 落合秀也 今日の内容 グラフの連結性 の判定 幅優先探索 幅優先探索の実現方法 深さ優先探索 深さ優先探索の実現方法 木の構造 探索木 パトリシア トライ 2 連結性の判定問題を考える グラフ G(V,E) が与えられたとき G が連結かどうか を判定したい 小さいグラフなら 紙に書いてみればよい 一般には簡単ではない 大きいグラフの場合 コンピュータに判断させる場合

More information

Thread

Thread 14 2013 7 16 14.1....................................... 14 1 14.2 Thread................................... 14 1 14.3............................. 14 5 14.4....................................... 14 10

More information

# let st1 = {name = "Taro Yamada"; id = };; val st1 : student = {name="taro Yamada"; id=123456} { 1 = 1 ;...; n = n } # let string_of_student {n

# let st1 = {name = Taro Yamada; id = };; val st1 : student = {name=taro Yamada; id=123456} { 1 = 1 ;...; n = n } # let string_of_student {n II 6 / : 2001 11 21 (OCaml ) 1 (field) name id type # type student = {name : string; id : int};; type student = { name : string; id : int; } student {} type = { 1 : 1 ;...; n : n } { 1 = 1 ;...; n = n

More information

bdd.gby

bdd.gby Haskell Behavior Driven Development 2012.5.27 @kazu_yamamoto 1 Haskell 4 Mew Firemacs Mighty ghc-mod 2 Ruby/Java HackageDB 3 Haskeller 4 Haskeller 5 Q) Haskeller A) 6 7 Haskeller Haskell 8 9 10 Haskell

More information

Sokushu2_perl

Sokushu2_perl hello.pl Perl print("hello, Bioinformatics!\n"); $ perl hello.pl 1 2 hello.pl print("hello, Bioinformatics!\n"); $ perl hello.pl 3 4 hello.pl 3 hello.pl Perl Perl Perl Perl print("hello, Bioinformatics!\n

More information

コンピュータ概論

コンピュータ概論 4.1 For Check Point 1. For 2. 4.1.1 For (For) For = To Step (Next) 4.1.1 Next 4.1.1 4.1.2 1 i 10 For Next Cells(i,1) Cells(1, 1) Cells(2, 1) Cells(10, 1) 4.1.2 50 1. 2 1 10 3. 0 360 10 sin() 4.1.2 For

More information

Python @HACHINONE 10 1 V Python 2014 2 : L[i] # -*- coding: utf-8 -*- def search(l, e): """L をリスト e をオブジェクトとする L に e が含まれていれば True そうでなければ False を返す """ for i in range(len(l)): if L[i] == e: return True

More information

グラフの探索 JAVA での実装

グラフの探索 JAVA での実装 グラフの探索 JAVA での実装 二つの探索手法 深さ優先探索 :DFS (Depth-First Search) 幅優先探索 :BFS (Breadth-First Search) 共通部分 元のグラフを指定して 極大木を得る 探索アルゴリズムの利用の観点から 利用する側からみると 取り替えられる部品 どちらの方法が良いかはグラフに依存 操作性が同じでなければ 共通のクラスの派生で作ると便利 共通化を考える

More information

Windows Cygwin Mac *1 Emacs Ruby ( ) 1 Cygwin Bash Cygwin Windows Cygwin Cygwin Mac 1 Mac 1.2 *2 ls *3 *1 OS Linux *2 *3 Enter ( ) 2

Windows Cygwin Mac *1 Emacs Ruby ( ) 1 Cygwin Bash Cygwin Windows Cygwin Cygwin Mac 1 Mac 1.2 *2 ls *3 *1 OS Linux *2 *3 Enter ( ) 2 September 2016 1 Windows Cygwin Mac *1 Emacs Ruby 1 1.1 ( ) 1 Cygwin Bash Cygwin Windows Cygwin Cygwin Mac 1 Mac 1.2 *2 ls *3 *1 OS Linux *2 *3 Enter ( ) 2 ~/16:00:20> ls 2 2 ls ls -a ~/16:00:20> ls -a

More information

連載 構文解析器結合子 山下伸夫 (( 株 ) タイムインターメディア ) 文字列の分解 1 1 Haskell lines Prelude lines :: String -> [String] lines "" = [] lines s = let (l,s'

連載 構文解析器結合子 山下伸夫 (( 株 ) タイムインターメディア ) 文字列の分解 1 1 Haskell lines Prelude lines :: String -> [String] lines  = [] lines s = let (l,s' 連載 構文解析器結合子 山下伸夫 (( 株 ) タイムインターメディア ) nobsun@sampou.org 文字列の分解 1 1 Haskell lines Prelude lines :: String -> [String] lines "" = [] lines s = let (l,s') = break ('\n'==) s in l : case s' of [] -> [] (_:s'')

More information

2008 DS T050049

2008 DS T050049 DS T050049. PSP DS DS DS RPG DS OS Windows XP DevkiPro OS DS CPU ARM devkitarm MSYS MinGW MSYS MinGW Unix OS C++ C++ make nds nds DS DS micro SD Card nds DS DS DS nds C Java C++ nds nds DS 2008 DS T050049

More information

ruby novice ruby novice ruby novice.

ruby novice ruby novice ruby novice. GitHub Ruby 2549 2017 3 1 1 3 2 4 2.1 ruby novice........................... 4 2.2.............................. 6 3 8 3.1 ruby novice....................... 8 3.2 ruby novice............................

More information

memo

memo 計数工学プログラミング演習 ( 第 5 回 ) 2017/05/09 DEPARTMENT OF MATHEMATICAL INFORMATICS 1 内容 文字列 双方向リスト ハッシュ 2 文字列 文字列は char の配列 char name[] = ABC ; name は ABC を格納するのに十分な長さの配列 長さは, 文字列の長さ + 1 ( 終端記号用 ) char name[4]

More information

BASIC / / BA- SIC Web 1/10 1/10 / / JavaScript

BASIC / / BA- SIC Web 1/10 1/10 / / JavaScript BASIC / / BA- SIC Web 1/10 1/10 // JavaScript MIT Processing line(10,10,100,100); 1 BASIC / Phidgets 1 GAINER 2 USB / Phidgets USB 1: 1 http://www.phidgets.com/ 2 http://gainer.cc/ / / BGM Phidgets University

More information

BW BW

BW BW Induced Sorting BW 11T2042B 2015 3 23 1 1 1.1................................ 1 1.2................................... 1 2 BW 1 2.1..................................... 2 2.2 BW.................................

More information

Microsoft Word - NonGenList.doc

Microsoft Word - NonGenList.doc ジェネリクスとコンパレータを使用しないリストのプログラム例 1. ポインタによる線形リスト LinkedListNG.java: ポインタによる線形リストのクラス LinkedListNG LinkedListTesterNG.java: LinkedListNG を利用するプログラム例 2. カーソルによる線形リスト AryLinkedListNG.java: カーソルによる線形リストのクラス AryLinkedListNG

More information

I. Backus-Naur BNF S + S S * S S x S +, *, x BNF S (parse tree) : * x + x x S * S x + S S S x x (1) * x x * x (2) * + x x x (3) + x * x + x x (4) * *

I. Backus-Naur BNF S + S S * S S x S +, *, x BNF S (parse tree) : * x + x x S * S x + S S S x x (1) * x x * x (2) * + x x x (3) + x * x + x x (4) * * 2015 2015 07 30 10:30 12:00 I. I VI II. III. IV. a d V. VI. 80 100 60 1 I. Backus-Naur BNF S + S S * S S x S +, *, x BNF S (parse tree) : * x + x x S * S x + S S S x x (1) * x x * x (2) * + x x x (3) +

More information

listings-ext

listings-ext (10) (2) ( ) ohsaki@kwansei.ac.jp 8 (2) 1 8.1.............................. 1 8.2 mobility.fixed.......................... 2 8.3 mobility.randomwalk...................... 7 8.4 mobility.randomwaypoint...................

More information

明解Javaによるアルゴリズムとデータ構造

明解Javaによるアルゴリズムとデータ構造 74 searching 3 key Fig.3-1 75 2を探索 53を探索 3-1 5 2 1 4 3 7 4 を探索 Fig.3-1 76 3 linear searchsequential search 2 Fig.3-2 0 ❶ ❷ ❸ 配列の要素を先頭から順に走査していく 探索すべき値と等しい要素を発見 Fig.3-2 6 4 3 2 3-2Fig.3-3 77 5 Fig.3-3 0

More information

1-4 int a; std::cin >> a; std::cout << "a = " << a << std::endl; C++( 1-4 ) stdio.h iostream iostream.h C++ include.h 1-4 scanf() std::cin >>

1-4 int a; std::cin >> a; std::cout << a =  << a << std::endl; C++( 1-4 ) stdio.h iostream iostream.h C++ include.h 1-4 scanf() std::cin >> 1 C++ 1.1 C C++ C++ C C C++ 1.1.1 C printf() scanf() C++ C hello world printf() 1-1 #include printf( "hello world\n" ); C++ 1-2 std::cout

More information

PowerPoint Presentation

PowerPoint Presentation p.130 p.198 p.208 2 double weight[num]; double min, max; min = max = weight[0]; for( i= 1; i i < NUM; i++ ) ) if if ( weight[i] > max ) max = weight[i]: if if ( weight[i] < min ) min = weight[i]: weight

More information

解きながら学ぶJava入門編

解きながら学ぶJava入門編 44 // class Negative { System.out.print(""); int n = stdin.nextint(); if (n < 0) System.out.println(""); -10 Ÿ 35 Ÿ 0 n if statement if ( ) if i f ( ) if n < 0 < true false true false boolean literalboolean

More information

Taro-リストⅢ(公開版).jtd

Taro-リストⅢ(公開版).jtd リスト Ⅲ 0. 目次 2. 基本的な操作 2. 1 リストから要素の削除 2. 2 リストの複写 2. 3 リストの連結 2. 4 問題 問題 1 問題 2-1 - 2. 基本的な操作 2. 1 リストから要素の削除 まず 一般的な処理を書き つぎに 特別な処理を書く 一般的な処理は 処理 1 : リスト中に 削除するデータを見つけ 削除する場合への対応 特別な処理は 処理 2 : 先頭のデータを削除する場合への対応

More information

アルゴリズムとデータ構造1

アルゴリズムとデータ構造1 1 2007 6 26 26 (sakai.keiichi@kochi sakai.keiichi@kochi-tech.ac.jp) http://www.info.kochi-tech.ac.jp/k1sakai/lecture/alg/2007/index.html tech.ac.jp/k1sakai/lecture/alg/2007/index.html FIFO (46 ) head,

More information

listings-ext

listings-ext (6) Python (2) ( ) ohsaki@kwansei.ac.jp 5 Python (2) 1 5.1 (statement)........................... 1 5.2 (scope)......................... 11 5.3 (subroutine).................... 14 5 Python (2) Python 5.1

More information

やさしいJavaプログラミング -Great Ideas for Java Programming サンプルPDF

やさしいJavaプログラミング -Great Ideas for Java Programming サンプルPDF pref : 2004/6/5 (11:8) pref : 2004/6/5 (11:8) pref : 2004/6/5 (11:8) 3 5 14 18 21 23 23 24 28 29 29 31 32 34 35 35 36 38 40 44 44 45 46 49 49 50 pref : 2004/6/5 (11:8) 50 51 52 54 55 56 57 58 59 60 61

More information

¥¤¥ó¥¿¡¼¥Í¥Ã¥È·×¬¤È¥Ç¡¼¥¿²òÀÏ Âè2²ó

¥¤¥ó¥¿¡¼¥Í¥Ã¥È·×¬¤È¥Ç¡¼¥¿²òÀÏ Âè2²ó 2 212 4 13 1 (4/6) : ruby 2 / 35 ( ) : gnuplot 3 / 35 ( ) 4 / 35 (summary statistics) : (mean) (median) (mode) : (range) (variance) (standard deviation) 5 / 35 (mean): x = 1 n (median): { xr+1 m, m = 2r

More information

Microsoft PowerPoint - kougi10.ppt

Microsoft PowerPoint - kougi10.ppt C プログラミング演習 第 10 回二分探索木 1 例題 1. リストの併合 2 つのリストを併合するプログラムを動かしてみる head1 tail1 head2 tail2 NULL NULL head1 tail1 tail1 があると, リストの併合に便利 NULL 2 #include "stdafx.h" #include struct data_list { int data;

More information

() / (front end) (back end) (phase) (pass) 1 2

() / (front end) (back end) (phase) (pass) 1 2 1 () () lex http://www.cs.info.mie-u.ac.jp/~toshi/lectures/compiler/ 2018 4 1 () / (front end) (back end) (phase) (pass) 1 2 () () var left, right; fun int main() { left = 0; right = 10; return ((left

More information

PowerPoint プレゼンテーション

PowerPoint プレゼンテーション プログラミング応用演習 第 4 回再帰的構造体 前回の出席確認演習 #include int main() { FILE *fp; int c, linecount, length, maxlength; fp=fopen("/usr/share/dict/words","r"); if (fp == NULL) return 1; linecount=0; length=0;

More information

1 Ex Ex. 2 2

1 Ex Ex. 2 2 I 20 100 85 40 85 PDF Windows TA ruby TA6 2 8 1. 2. PDF 3. PDF 1 Ex. 1 2 2 Ex. 2 2 2 Ex. 3 seisu = Array.new(3, 0) seisu[0] = gets.chomp.to_i seisu[1] = gets.chomp.to_i seisu[2] = gets.chomp.to_i wa =

More information

1 # include < stdio.h> 2 # include < string.h> 3 4 int main (){ 5 char str [222]; 6 scanf ("%s", str ); 7 int n= strlen ( str ); 8 for ( int i=n -2; i

1 # include < stdio.h> 2 # include < string.h> 3 4 int main (){ 5 char str [222]; 6 scanf (%s, str ); 7 int n= strlen ( str ); 8 for ( int i=n -2; i ABC066 / ARC077 writer: nuip 2017 7 1 For International Readers: English editorial starts from page 8. A : ringring a + b b + c a + c a, b, c a + b + c 1 # include < stdio.h> 2 3 int main (){ 4 int a,

More information

Microsoft PowerPoint - 11RubyIntro-No02.ppt [互換モード]

Microsoft PowerPoint - 11RubyIntro-No02.ppt [互換モード] Ruby 入門 東京電機大学櫻井彰人 Ruby とは? Ruby: 松本ゆきひろ氏による (1993) 純粋オブジェクト指向 スクリプト言語 Web プログラムで どんどんポピュラーに Ruby on Rails (http://www.rubyonrails.org/) なぜか きわめて Lisp like 松本行弘 (Matz) Introduction 実行環境 Windows/Unix/Linux/

More information

yacc.dvi

yacc.dvi 2017 c 8 Yacc Mini-C C/C++, yacc, Mini-C, run,, Mini-C 81 Yacc Yacc, 1, 2 ( ), while ::= "while" "(" ")" while yacc 1: st while : lex KW WHILE lex LPAREN expression lex RPAREN statement 2: 3: $$ = new

More information

II 3 yacc (2) 2005 : Yacc 0 ~nakai/ipp2 1 C main main 1 NULL NULL for 2 (a) Yacc 2 (b) 2 3 y

II 3 yacc (2) 2005 : Yacc 0 ~nakai/ipp2 1 C main main 1 NULL NULL for 2 (a) Yacc 2 (b) 2 3 y II 3 yacc (2) 2005 : Yacc 0 ~nakai/ipp2 1 C 1 6 9 1 main main 1 NULL NULL 1 15 23 25 48 26 30 32 36 38 43 45 47 50 52 for 2 (a) 2 2 1 Yacc 2 (b) 2 3 yytext tmp2 ("") tmp2->next->word tmp2 yytext tmp2->next->word

More information