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

Size: px
Start display at page:

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

Transcription

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

2 1: List 4-1(p.100) stack[] stack top 1 2 (push) (pop) 1 2 void stack push(double val) val stack top 1 double stack pop(void) stack top 1 1: 1 #define STACK MAX / d o u b l e / 4 double s t a c k [STACK MAX ] ; 5 / / 6 int s t a c k t o p =0; 7 8 / push / 9 void s t a c k p u s h ( double v a l ) 10 { 11 i f ( s t a c k t o p==stack MAX) 12 { 13 / / 14 p r i n t f ( : ( Stack o v e r f l o w )\ n ) ; 1 2

3 15 e x i t (EXIT FAILURE ) ; 16 } 17 else 18 { 19 / / 20 s t a c k [ s t a c k t o p ]= v a l ; 21 ++s t a c k t o p ; 22 } 23 } / pop / 26 double stack pop ( void ) 27 { 28 i f ( s t a c k t o p ==0) 29 { 30 / / 31 p r i n t f ( : p o p 32 ( Stack underflow )\ n ) ; 33 e x i t (EXIT FAILURE ) ; 34 return 0 ; 35 } 36 else 37 { 38 / / 39 s t a c k t o p ; 40 return s t a c k [ s t a c k t o p ] ; 41 } 42 } (queue) queue 2 FIFO(first in first out, ) 2: FIFO 3

4 3 3: List 4-4(p ) queue[] queue[] queue first queue last void enqueue(int val) val queue last 1 () int dequeue(void) queue first 1 () QUEUE EMPTY 2: 1 #define QUEUE MAX 5+1 / +1 / 2 #define QUEUE EMPTY 1 3 4

5 4 / / 5 int queue [QUEUE MAX] ; 6 / / 7 int q u e u e f i r s t =0; 8 / / 9 int q u e u e l a s t =0; / / 12 void enqueue ( int v a l ) 13 { 14 / l a s t f i r s t / 15 i f ( ( q u e u e l a s t +1)%QUEUE MAX ==q u e u e f i r s t ) 16 { 17 / / 18 p r i n t f ( \n ) ; 19 } 20 else 21 { 22 / / 23 queue [ q u e u e l a s t ]= v a l ; 24 / q u e u e l a s t 1 25 / 26 q u e u e l a s t =( q u e u e l a s t +1)%QUEUE MAX; 27 } 28 } / / 31 int dequeue ( void ) 32 { 33 int r e t ; i f ( q u e u e f i r s t==q u e u e l a s t ) 36 { 37 / 1 / 38 return QUEUE EMPTY; 39 } 40 else 41 { 42 / / 43 r e t=queue [ q u e u e f i r s t ] ; 44 / / 45 q u e u e f i r s t =( q u e u e f i r s t +1)%QUEUE MAX; 46 return r e t ; 47 } 48 } 2.3 [ 1] [ 2] LIFO? [ 3] PUSH(n) : n POP() : 5

6 PUSH(3) PUSH(5) POP() PUSH(2) PUSH(1) POP() POP() PUSH(1) POP() PUSH(7) [ 4] POP() [ 5] [ 6] FIFO? [ 7] [ 8] ENQ(n) : n DEQ() : ENQ(6) ENQ(2) DEQ() ENQ(7) DEQ() ENQ(3) ENQ(1) ENQ(2) DEQ() DEQ() [ 9] DEQ() (recursive call)! 5 5! = = 120 (1) n n! = n (n 1) (n 2) 2 1 (2) 0! = 1 n! = n (n 1)! (3) 0! = 1 (4) (2) 3 (3) (4) 4 6

7 4 3 (recursive call) C 3: 1 #include <s t d i o. h> 2 3 / ===================================================== / 4 / / 5 / ===================================================== / 6 int k a i j y o ( int n ){ 7 int i, value ; 8 9 value =1; for ( i=n ; i >=1; i ){ 12 value = i ; 13 } return value ; } / ===================================================== / 20 / / 21 / ===================================================== / 22 int main ( ) { 23 int n ; p r i n t f ( \n ) ; 26 s c a n f ( %d,&n ) ; p r i n t f ( %d!=%d\n, n, k a i j y o ( n ) ) ; return 0 ; 31 } 4: 1 #include <s t d i o. h> 2 3 / ===================================================== / 4 / / 5 / ===================================================== / 6 int k a i j y o ( int n ){ 7 8 i f ( n==0){ 9 return 1 ; 7

8 10 } else { 11 return n k a i j y o ( n 1); 12 } } / ===================================================== / 17 / / 18 / ===================================================== / 19 int main ( ) { 20 int n ; p r i n t f ( \n ) ; 23 s c a n f ( %d,&n ) ; p r i n t f ( %d!=%d\n, n, k a i j y o ( n ) ) ; return 0 ; 28 } 3.2 [ 1] () F 7? F k = F k 1 + F k 2 F 0 = 0 F 1 = 1 [ 2] [ 3] n 2 F (n) F (0) = 1 F (n) = F (n) F (n 1) F (n 1) F (n 2) n F (n 1) (n 1) F (n) [ 4] n n n n! n! = n(n 1)(n 2) 2 1 8

9 tree() 1 4 6? 1: (root:) (node:) (leaf:) (branch:) (parent) (child) (brother) 4: E (binary search tree) 2 9

10 ??2 5: (2 ) : 2 ( List 6-1) 1 typedef struct t a g t r e e n o d e 2 { 3 / / 4 int value ; 5 / n o d e / 6 struct t a g t r e e n o d e l e f t ; 7 / n o d e / 8 struct t a g t r e e n o d e r i g h t ; 9 } t r e e n o d e ; List 6-4(p.176) tree_node *tree_root=null; tree node (NULL) 10

11 6: List6-1List [ 1] 2? () () () () [ 2] 2 69,26,36,45,89,65,11,12,14,23,44 [ 3] 2 70,73,67,75,77,66 11

12 2 [ 4] 2 52,46,54 2 [ 5] (rounding error) C () 2 sin x = x x3 3! + x5 5! x7 7! + x9 9! x11 11! + = ( 1) n+1 x 2n 1 (2n 1)! n=1 (5) 12

13 5.2 [a, b] f(x) f(a)f(b) < 0 (6) f(α) = 0 α [a, b] f(a)f(b) < 0 2 a, b(a < b) [a, b] 2 c = (a + b)/2 f(c) f(c)f(a) < 0 b c f(c)f(a) > 0 a c [a, b] b a ε 1/2 6 a left b riht c mid ε epsilon 6: 1 #include <s t d i o. h> 2 #include <math. h> 3 #include <s t d l i b. h> 4 5 double func ( double x ) 6 { 7 return x cos ( x)+ s i n ( x)+exp( x x)+x x x 3; 8 } double BinarySearch ( void ) 12 { 13 double l e f t, mid, r i g h t, e p s i l o n ; e p s i l o n = ; l e f t = 2.0; 18 r i g h t =2.0; while ( f a b s ( r i g h t l e f t )> e p s i l o n ) 13

14 21 { 22 mid=( l e f t+r i g h t ) / 2. 0 ; i f ( func ( l e f t ) func ( mid) >=0.0) 25 l e f t=mid ; 26 else 27 r i g h t=mid ; 28 } 29 return l e f t ; 30 } int main ( void ) 33 { 34 double d ; 35 d=binarysearch ( ) ; 36 p r i n t f ( %l f 37 func ( x )% l f \n, d, func ( d ) ) ; 38 return EXIT SUCCESS ; 39 } 5.3 [ 1] C 3 [ 2] 2 () [1],.. (),

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

(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

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

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

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

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

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

C 2 2.1? 3x 2 + 2x + 5 = 0 (1) 1

C 2 2.1? 3x 2 + 2x + 5 = 0 (1) 1 2006 7 18 1 2 C 2 2.1? 3x 2 + 2x + 5 = 0 (1) 1 2 7x + 4 = 0 (2) 1 1 x + x + 5 = 0 2 sin x x = 0 e x + x = 0 x = cos x (3) x + 5 + log x? 0.1% () 2.2 p12 3 x 3 3x 2 + 9x 8 = 0 (4) 1 [ ] 1/3 [ 2 1 ( x 1

More information

第2回

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

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

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

[ 1] 1 Hello World!! 1 #include <s t d i o. h> 2 3 int main ( ) { 4 5 p r i n t f ( H e l l o World!! \ n ) ; 6 7 return 0 ; 8 } 1:

[ 1] 1 Hello World!! 1 #include <s t d i o. h> 2 3 int main ( ) { 4 5 p r i n t f ( H e l l o World!! \ n ) ; 6 7 return 0 ; 8 } 1: 005 9 7 1 1.1 1 Hello World!! 5 p r i n t f ( H e l l o World!! \ n ) ; 7 return 0 ; 8 } 1: 1 [ ] Hello World!! from Akita National College of Technology. 1 : 5 p r i n t f ( H e l l o World!! \ n ) ;

More information

橡Pro PDF

橡Pro PDF 1 void main( ) char c; /* int c; */ int sum=0; while ((c = getchar())!= EOF) if(isdigit(c) ) sum += (c-'0'); printf("%d\n", sum); main()int i,sum=0; for(i=0;i

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

untitled

untitled II yacc 005 : 1, 1 1 1 %{ int lineno=0; 3 int wordno=0; 4 int charno=0; 5 6 %} 7 8 %% 9 [ \t]+ { charno+=strlen(yytext); } 10 "\n" { lineno++; charno++; } 11 [^ \t\n]+ { wordno++; charno+=strlen(yytext);}

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

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

PowerPoint Presentation

PowerPoint Presentation スタックと待ち行列 Algorithms and Data Structures on C この回の要点 スタック スタックの構造 最後に入れたものが 最初に取り出される (LIFO) 日常に良くある ちょっと置いといて の概念 C 言語の配列による実装 スタックオーバーフロー スタックアンダーフロー 逆ポーランド記法電卓 待ち行列 待ち行列の構造 最初に入れたものが 最初に取り出される (FIFO)

More information

/* do-while */ #include <stdio.h> #include <math.h> int main(void) double val1, val2, arith_mean, geo_mean; printf( \n ); do printf( ); scanf( %lf, &v

/* do-while */ #include <stdio.h> #include <math.h> int main(void) double val1, val2, arith_mean, geo_mean; printf( \n ); do printf( ); scanf( %lf, &v 1 http://www7.bpe.es.osaka-u.ac.jp/~kota/classes/jse.html kota@fbs.osaka-u.ac.jp /* do-while */ #include #include int main(void) double val1, val2, arith_mean, geo_mean; printf( \n );

More information

O(N) ( ) log 2 N

O(N) ( ) log 2 N 2005 11 21 1 1.1 2 O(N) () log 2 N 1.2 2 1 List 3-1 List 3-3 List 3-4? 3 3.1 3.1.1 List 2-1(p.70) 1 1 10 1 3.1.2 List 3-1(p.70-71) 1 1 2 1 2 2 1: 1 3 3.1.3 1 List 3-1(p.70-71) 2 #include stdlib.h

More information

Microsoft PowerPoint - 06.pptx

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

More information

C による数値計算法入門 ( 第 2 版 ) 新装版 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます. このサンプルページの内容は, 新装版 1 刷発行時のものです.

C による数値計算法入門 ( 第 2 版 ) 新装版 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます.  このサンプルページの内容は, 新装版 1 刷発行時のものです. C による数値計算法入門 ( 第 2 版 ) 新装版 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます. http://www.morikita.co.jp/books/mid/009383 このサンプルページの内容は, 新装版 1 刷発行時のものです. i 2 22 2 13 ( ) 2 (1) ANSI (2) 2 (3) Web http://www.morikita.co.jp/books/mid/009383

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

memo

memo 計数工学プログラミング演習 ( 第 6 回 ) 2016/05/24 DEPARTMENT OF MATHEMATICAL INFORMATICS 1 今日の内容 : 再帰呼び出し 2 分探索木 深さ優先探索 課題 : 2 分探索木を用いたソート 2 再帰呼び出し 関数が, 自分自身を呼び出すこと (recursive call, recursion) 再帰を使ってアルゴリズムを設計すると, 簡単になることが多い

More information

平成 31 年度 筑波大学大学院博士課程 システム情報工学研究科 コンピュータサイエンス専攻 博士前期課程 ( 一般入学試験 8 月期 ) 試験問題基礎科目 ( 数学, 情報基礎 ) Mathematics/Fundamentals of Computer Science [ 注意事項 ][Inst

平成 31 年度 筑波大学大学院博士課程 システム情報工学研究科 コンピュータサイエンス専攻 博士前期課程 ( 一般入学試験 8 月期 ) 試験問題基礎科目 ( 数学, 情報基礎 ) Mathematics/Fundamentals of Computer Science [ 注意事項 ][Inst 平成 31 年度 筑波大学大学院博士課程 システム情報工学研究科 コンピュータサイエンス専攻 博士前期課程 ( 一般入学試験 8 月期 ) 試験問題基礎科目 ( 数学, 情報基礎 ) Mathematics/Fundamentals of Computer Science [ 注意事項 ][Instructions] 1. 試験開始の合図があるまで, 問題の中を見てはいけません. また, 筆記用具を手に持ってはいけません.

More information

離散数学

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

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

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

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

PowerPoint プレゼンテーション

PowerPoint プレゼンテーション プログラミング応用演習 第 4 回再帰的構造体 プログラミングを 余談 : 教えることの難しさ 丁寧に説明しないと分かってもらえない 説明すると 小難しくなる学生が目指すべきところプログラム例を説明されて理解できる違うやり方でも良いので自力で解決できる おっけー 動けば良い という意識でプログラミング 正しく動くことのチェックは必要 解答例と自分のやり方との比較が勉強になる 今日のお題 再帰的構造体

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

program.dvi

program.dvi 2001.06.19 1 programming semi ver.1.0 2001.06.19 1 GA SA 2 A 2.1 valuename = value value name = valuename # ; Fig. 1 #-----GA parameter popsize = 200 mutation rate = 0.01 crossover rate = 1.0 generation

More information

第2回

第2回 明星大学情報学科 年後期 アルゴリズムとデータ構造 Ⅰ 第 回 Page 第 回基本データ構造 連結リストとその操作 -. リスト構造 データ部 と ポインタ部 で構成され ポインタをたどることによりデータを扱うことができる構造 -. 単方向リストとその操作 --. 単方向リスト 次のデータへのポインタを つだけ持っているデータ構造 ( データ部は 複数のデータを持っている場合もある ) データ部

More information

P06.ppt

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

More information

PowerPoint Presentation

PowerPoint Presentation 幅優先探索アルゴリズム 復習 Javaでの実装 深さ優先探索 復習 Javaでの実装 1 探索アルゴリズムの一覧 問題を解決するための探索 幅優先探索 深さ優先探索 深さ制限探索 均一コスト探索 反復深化法 欲張り探索 山登り法 最良優先探索 2 Breadth-first search ( 幅優先探索 ) 探索アルゴリズムはノードやリンクからなる階層的なツリー構造で構成された状態空間を探索するアルゴリズムです

More information

C言語によるアルゴリズムとデータ構造

C言語によるアルゴリズムとデータ構造 Algorithms and Data Structures in C 4 algorithm List - /* */ #include List - int main(void) { int a, b, c; int max; /* */ Ÿ 3Ÿ 2Ÿ 3 printf(""); printf(""); printf(""); scanf("%d", &a); scanf("%d",

More information

£Ã¥×¥í¥°¥é¥ß¥ó¥°(2018) - Âè11²ó – ½ÉÂꣲ¤Î²òÀ⡤±é½¬£² –

£Ã¥×¥í¥°¥é¥ß¥ó¥°(2018) - Âè11²ó – ½ÉÂꣲ¤Î²òÀ⡤±é½¬£² – (2018) 11 2018 12 13 2 g v dv x dt = bv x, dv y dt = g bv y (1) b v 0 θ x(t) = v 0 cos θ ( 1 e bt) (2) b y(t) = 1 ( v 0 sin θ + g ) ( 1 e bt) g b b b t (3) 11 ( ) p14 2 1 y 4 t m y > 0 y < 0 t m1 h = 0001

More information

memo

memo 計数工学プログラミング演習 ( 第 6 回 ) 2017/05/16 DEPARTMENT OF MATHEMATICAL INFORMATICS 1 今日の内容 : 再帰呼び出し 2 分探索木 深さ優先探索 課題 : 2 分探索木を用いたソート 2 再帰呼び出し 関数が, 自分自身を呼び出すこと (recursive call, recursion) 再帰を使ってアルゴリズムを設計すると, 簡単になることが多い

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

I. Backus-Naur BNF : N N 0 N N N N N N 0, 1 BNF N N 0 11 (parse tree) 11 (1) (2) (3) (4) II. 0(0 101)* (

I. Backus-Naur BNF : N N 0 N N N N N N 0, 1 BNF N N 0 11 (parse tree) 11 (1) (2) (3) (4) II. 0(0 101)* ( 2016 2016 07 28 10:30 12:00 I. I VI II. III. IV. a d V. VI. 80 100 60 1 I. Backus-Naur BNF : 11011 N N 0 N N 11 1001 N N N N 0, 1 BNF N N 0 11 (parse tree) 11 (1) 1100100 (2) 1111011 (3) 1110010 (4) 1001011

More information

compiler-text.dvi

compiler-text.dvi 2018.4 1 2 2.1 1 1 1 1: 1. (source program) 2. (object code) 3. 1 2.2 C if while return C input() output() fun var ( ) main() C (C-Prime) C A B C 2.3 Pascal P 1 C LDC load constant LOD load STR store AOP

More information

新版明解C言語 実践編

新版明解C言語 実践編 2 List - "max.h" a, b max List - max "max.h" #define max(a, b) ((a) > (b)? (a) : (b)) max List -2 List -2 max #include "max.h" int x, y; printf("x"); printf("y"); scanf("%d", &x); scanf("%d", &y); printf("max(x,

More information

joho07-1.ppt

joho07-1.ppt 0xbffffc5c 0xbffffc60 xxxxxxxx xxxxxxxx 00001010 00000000 00000000 00000000 01100011 00000000 00000000 00000000 xxxxxxxx x y 2 func1 func2 double func1(double y) { y = y + 5.0; return y; } double func2(double*

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

alg2015-3r3.ppt

alg2015-3r3.ppt 1 アルゴリズムとデータ 構造 第 3 回基本的なデータ構造 ( リスト スタック キュー ) プログラミング で学ぶところ 授業で学ぶデータ構造の範囲 機械語のデータ型 レジスタ値とその番地 基本データ型 char, int, large int, double, 構造データ型 配列 (array), 構造体 (struct) 基本的データ構造 リスト (linked list), スタック (stack),

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 return main() { main main C 1 戻り値の型 関数名 引数 関数ブロックをあらわす中括弧 main() 関数の定義 int main(void){ printf("hello World!!\n"); return 0; 戻り値 1: main() 2.2 C main

1 return main() { main main C 1 戻り値の型 関数名 引数 関数ブロックをあらわす中括弧 main() 関数の定義 int main(void){ printf(hello World!!\n); return 0; 戻り値 1: main() 2.2 C main C 2007 5 29 C 1 11 2 2.1 main() 1 FORTRAN C main() main main() main() 1 return 1 1 return main() { main main C 1 戻り値の型 関数名 引数 関数ブロックをあらわす中括弧 main() 関数の定義 int main(void){ printf("hello World!!\n"); return

More information

Microsoft Word - no206.docx

Microsoft Word - no206.docx 3.2 双方向リスト 今までのリストは 前から順にたどることしかできませんでした 今度は逆にもたどることができる 双方向リストを扱います この場合は 構造体には次を表すポインタの他に前を表すポインタを持つ ことになります 今回は最初と最後をポインタを使うと取り扱いが面倒になるので 最初 (start) と最後 (end) を どちらとも構造体 ( 値は意味を持たない ) を使うことにします こうすることによって

More information

Microsoft PowerPoint - H22プログラミング第一(E)#12

Microsoft PowerPoint - H22プログラミング第一(E)#12 平成 22 年 7 月 20 日 ( 火 ) 担当 : 秋山 泰 7 月 20 日 修正 プログラミング第一 (E) 第 12 回 メモリの動的割り当て - malloc( ), calloc( ), realloc( ) - free ( ), メモリリーク データ構造の動的割当て - 要素 1 つごとの動的割当て - 大きな単位でまとめた動的割当て 補足補足 main( ) の引数 : argc,

More information

:30 12:00 I. I VI II. III. IV. a d V. VI

:30 12:00 I. I VI II. III. IV. a d V. VI 2018 2018 08 02 10:30 12:00 I. I VI II. III. IV. a d V. VI. 80 100 60 1 I. Backus-Naur BNF N N y N x N xy yx : yxxyxy N N x, y N (parse tree) (1) yxyyx (2) xyxyxy (3) yxxyxyy (4) yxxxyxxy N y N x N yx

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

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

新・明解C言語で学ぶアルゴリズムとデータ構造

新・明解C言語で学ぶアルゴリズムとデータ構造 第 1 章 基本的 1 n 141 1-1 三値 最大値 algorithm List 1-1 a, b, c max /* */ #include int main(void) { int a, b, c; int max; /* */ List 1-1 printf("\n"); printf("a"); scanf("%d", &a); printf("b"); scanf("%d",

More information

() () (parse tree) ( (( ) * 50) ) ( ( NUM 10 + NUM 30 ) * NUM 50 ) ( * ) ( + ) NUM 50 NUM NUM (abstract syntax tree, AST) ( (( ) * 5

() () (parse tree) ( (( ) * 50) ) ( ( NUM 10 + NUM 30 ) * NUM 50 ) ( * ) ( + ) NUM 50 NUM NUM (abstract syntax tree, AST) ( (( ) * 5 3 lex yacc http://www.cs.info.mie-u.ac.jp/~toshi/lectures/compiler/ 2018 6 1 () () (parse tree) ( ((10 + 30) * 50) ) ( ( NUM 10 + NUM 30 ) * NUM 50 ) ( * ) ( + ) NUM 50 NUM NUM 10 30 (abstract syntax tree,

More information

1 1.1 C 2 1 double a[ ][ ]; 1 3x x3 ( ) malloc() 2 double *a[ ]; double 1 malloc() dou

1 1.1 C 2 1 double a[ ][ ]; 1 3x x3 ( ) malloc() 2 double *a[ ]; double 1 malloc() dou 1 1.1 C 2 1 double a[ ][ ]; 1 3x3 0 1 3x3 ( ) 0.240 0.143 0.339 0.191 0.341 0.477 0.412 0.003 0.921 1.2 malloc() 2 double *a[ ]; double 1 malloc() double 1 malloc() free() 3 #include #include

More information

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

アルゴリズムとデータ構造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

I void* School of Information Science, Japan Advanced Institute of Science and Technology

I void* School of Information Science, Japan Advanced Institute of Science and Technology I117 25 void* School of Information Science, Japan Advanced Institute of Science and Technology sdict ( ) idict ; long long double void* Japan Advanced Institute of Science and Technology 2008 1-2 1 idict

More information

ohp10.dvi

ohp10.dvi 2015 10 2015.12.7 1 ( ) 2 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

FXneo FXneo PC FXneo FX 1 2

FXneo FXneo PC FXneo FX 1 2 FXneo FXneo PC FXneo FX 1 2 FXneo 1. 04 2. 07 PC FX 07 08 09 10 11 13 3. 14 14 19 4. 20 5. 21 3 FXneo 1. 1 4 FXneo 1. 1 1 / 1 5 FXneo 1. 1 2 6 FXneo 2. PC PC FXneo- 2 [ ] 7 FXneo 2. PC 8 FXneo 2. PC 50pips

More information

C 2 / 21 1 y = x 1.1 lagrange.c 1 / Laglange / 2 #include <stdio.h> 3 #include <math.h> 4 int main() 5 { 6 float x[10], y[10]; 7 float xx, pn, p; 8 in

C 2 / 21 1 y = x 1.1 lagrange.c 1 / Laglange / 2 #include <stdio.h> 3 #include <math.h> 4 int main() 5 { 6 float x[10], y[10]; 7 float xx, pn, p; 8 in C 1 / 21 C 2005 A * 1 2 1.1......................................... 2 1.2 *.......................................... 3 2 4 2.1.............................................. 4 2.2..............................................

More information

Taro-2分探索木Ⅱ(公開版).jtd

Taro-2分探索木Ⅱ(公開版).jtd 2 分探索木 Ⅱ 0. 目次 5. 2 分探索木の操作 5. 1 要素の探索 5. 2 直前の要素の探索 5. 3 直後の要素の探索 5. 4 要素の削除 5. 5 問題 問題 1-1 - 5. 2 分探索木の操作 5. 1 要素の探索 要素 44 の探索 (1) 要素 と 44 を比較して 左部分木をたどる (2) 要素 33 と 44 を比較して 右部分木をたどる (3) 要素 44 を見つけた

More information

[1] #include<stdio.h> main() { printf("hello, world."); return 0; } (G1) int long int float ± ±

[1] #include<stdio.h> main() { printf(hello, world.); return 0; } (G1) int long int float ± ± [1] #include printf("hello, world."); (G1) int -32768 32767 long int -2147483648 2147483647 float ±3.4 10 38 ±3.4 10 38 double ±1.7 10 308 ±1.7 10 308 char [2] #include int a, b, c, d,

More information

3.1 stdio.h iostream List.2 using namespace std C printf ( ) %d %f %s %d C++ cout cout List.2 Hello World! cout << float a = 1.2f; int b = 3; cout <<

3.1 stdio.h iostream List.2 using namespace std C printf ( ) %d %f %s %d C++ cout cout List.2 Hello World! cout << float a = 1.2f; int b = 3; cout << C++ C C++ 1 C++ C++ C C++ C C++? C C++ C *.c *.cpp C cpp VC C++ 2 C++ C++ C++ [1], C++,,1999 [2],,,2001 [3], ( )( ),,2001 [4] B.W. /D.M.,, C,,1989 C Web [5], http://kumei.ne.jp/c_lang/ 3 Hello World Hello

More information

CプログラミングI

CプログラミングI C プログラミング I Swap 関数を作る Stack データ構造のための準備 整数変数 x と y の値を取り替える関数 swap を作る 最初の試み : swap-01.c #include void swap(int a, int b) { int tmp; tmp = a; a = b; b = tmp; int main(void) { int x=10, y=30;

More information

P05.ppt

P05.ppt 2 1 list0415.c forfor #include int i, j; for (i = 1; i

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

2004 2005 2 2 1G01P038-0 1 2 1.1.............................. 2 1.2......................... 2 1.3......................... 3 2 4 2.1............................ 4 2.2....................... 4 2.3.......................

More information

main

main 14 1. 12 5 main 1.23 3 1.230000 3 1.860867 1 2. 1988 1925 1911 1867 void JPcalendar(int x) 1987 1 64 1 1 1 while(1) Ctrl C void JPcalendar(int x){ if (x > 1988) printf(" %d %d \n", x, x-1988); else if(x

More information

Microsoft Word - no15.docx

Microsoft Word - no15.docx ex33.c /* */ #define IDLENGTH 7 /* */ #define MAX 100 /* */ /* */ struct student char idnumber[idlength + 1]; /* */ int math; /* () */ int english; /* () */ int japanese; /* () */ double average; /* */

More information

£Ã¥×¥í¥°¥é¥ß¥ó¥°(2018) - Âè10²ó – ¿¹à¼°¤Îɾ²Á¡§¥¢¥ë¥´¥ê¥º¥à¤Î²þÁ± –

£Ã¥×¥í¥°¥é¥ß¥ó¥°(2018) - Âè10²ó – ¿¹à¼°¤Îɾ²Á¡§¥¢¥ë¥´¥ê¥º¥à¤Î²þÁ± – (2018) 10 2018 12 06 p(x) = a n x n + a n 1 x n 1 + + a 1 x + a 0 = n a n x n k=0 p(x) = a n x n + a n 1 x n 1 + + a 1 x + a 0 = n a n x n k=0 1 a k x k = a k {{ x x x p(x) = a n x n + a n 1 x n 1 + +

More information

C

C C 1 2 1.1........................... 2 1.2........................ 2 1.3 make................................................ 3 1.4....................................... 5 1.4.1 strip................................................

More information

‚æ4›ñ

‚æ4›ñ ( ) ( ) ( ) A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9 (OUS) 9 26 1 / 28 ( ) ( ) ( ) A B C D Z a b c d z 0 1 2 9 (OUS) 9

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

:30 12:00 I. I VI II. III. IV. a d V. VI

:30 12:00 I. I VI II. III. IV. a d V. VI 2017 2017 08 03 10:30 12:00 I. I VI II. III. IV. a d V. VI. 80 100 60 1 I. Backus-Naur BNF X [ S ] a S S ; X X X, S [, a, ], ; BNF X (parse tree) (1) [a;a] (2) [[a]] (3) [a;[a]] (4) [[a];a] : [a] X 2 222222

More information

( ) 1 1: 1 #include <s t d i o. h> 2 #include <GL/ g l u t. h> 3 #include <math. h> 4 #include <s t d l i b. h> 5 #include <time. h>

( ) 1 1: 1 #include <s t d i o. h> 2 #include <GL/ g l u t. h> 3 #include <math. h> 4 #include <s t d l i b. h> 5 #include <time. h> 2007 12 5 1 2 2.1 ( ) 1 1: 1 #include 2 #include 3 #include 4 #include 5 #include 6 7 #define H WIN 400 // 8 #define W WIN 300 // 9

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

A/B (2018/10/19) Ver kurino/2018/soft/soft.html A/B

A/B (2018/10/19) Ver kurino/2018/soft/soft.html A/B A/B (2018/10/19) Ver. 1.0 kurino@math.cst.nihon-u.ac.jp http://edu-gw2.math.cst.nihon-u.ac.jp/ kurino/2018/soft/soft.html 2018 10 19 A/B 1 2018 10 19 2 1 1 1.1 OHP.................................... 1

More information

double float

double float 2015 3 13 1 2 2 3 2.1.......................... 3 2.2............................. 3 3 4 3.1............................... 4 3.2 double float......................... 5 3.3 main.......................

More information

関数のグラフを描こう

関数のグラフを描こう L05(2010-05-07) 1 2 hig3.net ( ) L05(2010-05-07) 1 / 16 #i n c l u d e double f ( double x ) ; i n t main ( void ){ i n t n ; i n t nmax=10; double x ; double s =0.0; } x = 1.0; s=s+x ;

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

A/B (2010/10/08) Ver kurino/2010/soft/soft.html A/B

A/B (2010/10/08) Ver kurino/2010/soft/soft.html A/B A/B (2010/10/08) Ver. 1.0 kurino@math.cst.nihon-u.ac.jp http://edu-gw2.math.cst.nihon-u.ac.jp/ kurino/2010/soft/soft.html 2010 10 8 A/B 1 2010 10 8 2 1 1 1.1 OHP.................................... 1 1.2.......................................

More information

二分木の実装

二分木の実装 二分木の実装 この回の要点 二分木の C 言語による実装を理解する 再帰呼び出しによる木のなぞりの実装を理解する 関数ポインタを使った汎用処理の実装を理解する 実装コードの構成 汎用的構造 各ノードは void* を持つ 二分木のノード BinTreeNode.h BinTreeNode.cc 二分木 BinTree.h BinTree.cc テスト用 TestBinTree.cc BinTree

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

Original : Hello World! (0x0xbfab85e0) Copy : Hello World! (0x0x804a050) fgets mstrcpy malloc mstrcpy (main ) mstrcpy malloc free fgets stream 1 ( \n

Original : Hello World! (0x0xbfab85e0) Copy : Hello World! (0x0x804a050) fgets mstrcpy malloc mstrcpy (main ) mstrcpy malloc free fgets stream 1 ( \n 2008 3 10 1 mstrcpy char *mstrcpy(const char *src); mstrcpy malloc (main free ) stdio.h fgets char *fgets(char *s, int size, FILE *stream); s size ( ) stream FILE ( man ) 40 ( ) %./a.out String : test

More information

1 4 2 EP) (EP) (EP)

1 4 2 EP) (EP) (EP) 2003 2004 2 27 1 1 4 2 EP) 5 3 6 3.1.............................. 6 3.2.............................. 6 3.3 (EP)............... 7 4 8 4.1 (EP).................... 8 4.1.1.................... 18 5 (EP)

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

. 61 5,000 5,000 2 61 2 10 62 5 1 2 3 9 30 6 10 3 1 969 39 61 20 330 1040 1750 1360 57 60 1 10,000 96 5 5 94 80 5 15 5 100 82 18 2

. 61 5,000 5,000 2 61 2 10 62 5 1 2 3 9 30 6 10 3 1 969 39 61 20 330 1040 1750 1360 57 60 1 10,000 96 5 5 94 80 5 15 5 100 82 18 2 1. 2. 26 9 8 26 9 22 26 9 28 3. 26 10 1 26 12 31 4. 26 10 27 1 1 3 27 1 1 2 1 2 5. 1 1000 1,000 6. 1 10,000 A 500 11 B 500 11 1,000 A B 7. 10,000 8. 1 5 5 9. 10. 11. 1 2 1 . 61 5,000 5,000 2 61 2 10 62

More information

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

アルゴリズムとデータ構造 講義 アルゴリズムとデータ構造 第 3 回基本的なデータ構造 ( リスト スタック キュー ) 大学院情報科学研究科情報理工学専攻情報知識ネットワーク研究室喜田拓也 講義資料 2018/5/23 今日の内容 基本的なデータ構造リスト : 最も基本的なデータ集合の表現 配列 / 連結リスト / 双連結リストによる実装 スタック : 積み上げ式のデータ格納方式キュー : 入れた順に取り出せるデータ格納方式

More information

プログラム言語及び演習Ⅲ

プログラム言語及び演習Ⅲ 平成 28 年度後期データ構造とアルゴリズム期末テスト 各問題中のアルゴリズムを表すプログラムは, 変数の宣言が省略されているなど, 完全なものではありませんが, 適宜, 常識的な解釈をしてください. 疑問があれば, 挙手をして質問してください. 時間計算量をオーダ記法で表せという問題では, 入力サイズ n を無限大に近づけた場合の漸近的な時間計算量を表せということだと考えてください. 問題 1 入力サイズが

More information

tuat1.dvi

tuat1.dvi ( 1 ) http://ist.ksc.kwansei.ac.jp/ tutimura/ 2012 6 23 ( 1 ) 1 / 58 C ( 1 ) 2 / 58 2008 9 2002 2005 T E X ptetex3, ptexlive pt E X UTF-8 xdvi-jp 3 ( 1 ) 3 / 58 ( 1 ) 4 / 58 C,... ( 1 ) 5 / 58 6/23( )

More information

pptx

pptx iphone 2010 8 18 C xkozima@myu.ac.jp C Hello, World! Hello World hello.c! printf( Hello, World!\n );! os> ls! hello.c! os> cc hello.c o hello! os> ls! hello!!hello.c! os>./hello! Hello, World!! os>! os>

More information

2004

2004 2008 3 20 400 1 1,222 7 1 2 3 55.8 54.8 3 35.8 6 64.0 50.5 93.5 1 1,222 1 1,428 1 1,077 6 64.0 52.5 80.5 56.6 81.5 30.2 1 2 3 7 70.5 1 65.6 2 61.3 3 51.1 1 54.0 2 49.8 3 32.0 68.8 37.0 34.3 2008 3 2 93.5

More information

6-1

6-1 6-1 (data type) 6-2 6-3 ML, Haskell, Scala Lisp, Prolog (setq x 123) (+ x 456) (setq x "abc") (+ x 456) ; 6-4 ( ) subtype INDEX is INTEGER range -10..10; type DAY is (MON, TUE, WED, THU, FRI, SAT, SUN);

More information

DA13

DA13 データ構造とアルゴリズム第 13 回 知能情報学メジャー 和 俊和 5 整列 5.1 整列とは 5.2 単純な整列アルゴリズム 5.3 挿 ソートとその拡張 5.4 ヒープソート 5.5 クイックソート 5.6 マージソート 5.7 値の 較を いない整列 5.6 マージソート 1 与えられたデータ A を A " と A # にほぼ 等分する. 2A " と A # を整列する. このとき, データ数が

More information

1 1.1 C 2 1 double a[ ][ ]; 1 3x x3 ( ) malloc() malloc 2 #include <stdio.h> #include

1 1.1 C 2 1 double a[ ][ ]; 1 3x x3 ( ) malloc() malloc 2 #include <stdio.h> #include 1 1.1 C 2 1 double a[ ][ ]; 1 3x3 0 1 3x3 ( ) 0.240 0.143 0.339 0.191 0.341 0.477 0.412 0.003 0.921 1.2 malloc() malloc 2 #include #include #include enum LENGTH = 10 ; int

More information