Slide 1

Slide 1 text

ᄳ೻όkԟԬϼࢪӚ઺ٙԫ Code Smart, Don’t Code Hard  !਷ͭϓ̌ɽኪ༟ʈӻ᎜ ଭ͗ݰ ʃଭ$S#PZ DSCPZ!DSCPZOFU Release

Slide 2

Slide 2 text

ίක֐ʘۃ... й׊lεਪਪᕚl ʦ˂̥ਂ୑૵ᔊʧdШܘᛇڎଉɝীሞl ν؈̈ତи३༑...ࠅ३l ʕගʔ;ࢹdІ͟ආ̈ɪఽהᑺ˓ዚאွᙂ Шν؈ܘଢ଼ٙ༑...ఱᒔ݊;ࢹɓɨXD εਪਪᕚl й׊l

Slide 3

Slide 3 text

Ңࡁ˸ۃேܣჿᄳ೻όٙk

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

??

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

ԟ%(ճk

Slide 15

Slide 15 text

pr i ntf ˮ೐ l Ңᙼޒɧࡈᜊᅰd̜ఎprintfl

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

಻༊ৃࢹΙ˄εk

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

Ҫprintfᔷϓൗ༆ً࿒dഐҼவΫΥl

Slide 31

Slide 31 text

೻όᒔ݊׉׉ٙ

Slide 32

Slide 32 text

pr i ntf ˮ ೐ Ύ ତ l ࣅદ೻όᇁٙൗ༆d̜ఎprintfl

Slide 33

Slide 33 text

No content

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

Ыॆٙܘрɢ Ꮀ

Slide 37

Slide 37 text

ҢϞࣛࡉܘฌ͜ XDrz debug ج printf("XD"); /* do many things */ printf("rz\n"); ν؈ӚԒ᜗ఱ݊ݔࡈή˙ᖑદəXD XD ɰ݊ɓם

Slide 38

Slide 38 text

ϼࢪj˜рɢ݊ึϞΫజٙl εᄳɓࡈ̌ঐ̋ʱ™

Slide 39

Slide 39 text

Ыɦක֐рɢ

Slide 40

Slide 40 text

/*¶®•\§jæ«∏Í∞T§uµ{æ«®t98Ø≈§AØZ≤¶•…¨u æ«∏π°GF74942294*/ / ****************************************************************************** * FileName: hw7_s.c Programmer: CrBoy Purpose: ≥–≥y§@≠”singly linked list®√∞ı¶Ê¶U∫ÿ•\؇ Input: Output: the standard out Compilation: gcc hw7_s.c -o hw7_s Run: ./hw7_s Date: 2006/1/8 / ****************************************************************************** / #include struct node{ * int data; * struct node *next; }; typedef struct node node; void print_list(node*);/*print_list(h); ¶C¶L•Hh∂}¿Y™∫linked list*/ node *Insert(int, node*);/*Insert(data, h); ¶b•Hh∂}¿Y™∫linked list§§¥ °§Jdata®√¶^∂«∑s™∫h*/ node *Delete(int, node*);/*Delete(data, h); ¶b•Hh∂}¿Y™∫linked list§§ßR∞ £data®√¶^∂«∑s™∫h*/ node *Search(int, node*);/*Search(data, h); ¶b•Hh∂}¿Y™∫linked list§§¥Mß ‰data®√∂«¶^data©“¶b™∫¶Ï∏m*/ int Count(node*);/*Count(h); ≠p∫‚•Hh∂}¿Y™∫linked list§§™∫∏`¬I≠”º∆*/ node *Reverse(node*);/*Reverse(h); §œß«±∆¶C•Hh∂}¿Y™∫linked list®√∂«¶^∑s™∫h*/ node *Merge(node*, node*);/*Merge(h1, h2); ¶X®÷h1ªPh2≥o2≠”linked list®√¶^∂«¶X®÷´·™∫™∫head*/ void Split(node**, node**, node**);/*Split(&h, &h1, &h2); §¿≥Œh≥o≠”linked list¨∞©_∞∏º∆®√§¿ßO¶s®Ïh1ªPh2§§*/ void help(); int order=1; int main(void){ * int sel=8, data=0; * node *h=NULL, *h1=NULL, *h2=NULL; * help(); * while(sel){ * * printf("\n•ÿ´e™∫Linked list°G"); * * print_list(h); * * printf("Ω–øÔæ‹•\\؇°G"); * * if(scanf("%d", &sel)==0){ * * * sel=-1; * * * fflush(stdin); * * } * * switch(sel){ * * * case 0: break; * * * case 1: * * * * printf("Ω–øÈ§J±˝¥°§J™∫愺∆≠»°G"); * * * * if(scanf("%d", &data)==0) continue; * * * * if(order) * * * * * h = Insert(data, h); * * * * else{ * * * * * h = Reverse(h); * * * * * h = Insert(data, h); * * * * * h = Reverse(h); * * * * } * * * * break; * * * case 2: * * * * printf("Ω–øÈ§J±˝ßR∞£™∫愺∆≠»°G"); * * * * if(scanf("%d", &data)==0) continue; * * * * if(order) * * * * * h = Delete(data, h); * * * * else{ * * * * * h = Reverse(h); * * * * * h = Delete(data, h); * * * * * h = Reverse(h); * * * * } * * * * break; * * * case 3: * * * * printf("Ω–øÈ§J±˝∑j¥M™∫愺∆≠»°G"); * * * * if(scanf("%d", &data)==0) continue; * * * * h1 = Search(data, h); * * * * printf("•H%dß@¨∞∞_¬I™∫Linked list°G", data); * * * * print_list(h1); * * * * h1 = NULL; * * * * break; * * * case 4: * * * * printf("•ÿ´e™∫Linked list¶@¶≥%d≠”node °C\n", Count(h)); * * * * break; * * * case 5: * * * * h = Reverse(h); * * * * break; * * * case 6: * * * * printf("h1°G"); * * * * print_list(h1); * * * * printf("h2°G"); * * * * print_list(h2); * * * * h = Merge(h1, h2); * * * * h1 = h2 = NULL; * * * * break; * * * case 7: * * * * if(order) Split(&h, &h1, &h2); * * * * else{ * * * * * h = Reverse(h); * * * * * Split(&h, &h1, &h2); * * * * } * * * * printf("h1°G"); * * * * print_list(h1); * * * * printf("h2°G"); * * * * print_list(h2); * * * * break; * * * default: printf("±z™∫øÈ§J¶≥ª~°I\n"); * * * case 8: help(); * * } * } * return 0; } void print_list(node *h){ * node *temp; * temp = h; * while(temp != NULL){ * * printf("%d -> ", temp->data); * * temp = temp->next; * } * printf("NULL\n"); } node *Insert(int data, node *h){ * node *p, *t, *temp; * if(h==NULL){ * * temp = (node*)malloc(sizeof(node)); * * temp->data = data; * * temp->next = NULL; * * return temp; * } * p = h; * t = h->next; * if(datadata){ * * temp = (node*)malloc(sizeof(node)); * * temp->data = data; * * temp->next = p; * * return temp; * } * if(t!=NULL) * * while(datadata || data>t->data){ * * * p = p->next; * * * t = t->next; * * * if(t==NULL) break; * * } * temp = (node*)malloc(sizeof(node)); * temp->data = data; * temp->next = p->next; * p->next = temp; * return h; } node *Delete(int data, node *h){ * node *p, *t; * if(h==NULL) return h; * p = h; * t = h->next; * if(data == p->data){ * * p = p->next; * * free(h); * * return p; * } * while(data!=t->data){ * * p = p->next; * * t = t->next; * * if(t==NULL) return h; * } * p->next = t->next; * free(t); * return h; } node *Search(int data, node *h){ * node *p=h; * while(p!=NULL && data!=p->data)* p = p->next; * return p; } int Count(node *h){ * int count=0; * while(h!=NULL){ * * count += 1; * * h = h->next; * } * return count; } node *Reverse(node *h){ * node *a, *b, *c; * if(h==NULL || h->next==NULL) return h; * a = h; * b = a->next; * c = b->next; * a->next = NULL; * while(c!=NULL){ * * b->next = a; * * a = b; * * b = c; * * c = c->next; * } * b->next = a; * order = !order; * return b; } node *Merge(node *h1, node *h2){ * node *h, *temp; * h = temp = h1->data < h2->data ? h1 : h2; * h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); * while(h1!=NULL && h2!=NULL){ * * temp = temp->next = h1->data < h2->data ? h1 : h2; * * h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); * } * h2 == NULL ? (temp->next=h1) : (temp->next=h2); * return h; } void Split(node **h, node **h1_ptr, node **h2_ptr){ * node *h1=NULL, *h2=NULL; * while(*h!=NULL){ * * if((*h)->data%2){ * * * if(h1==NULL) h1 = *h1_ptr = *h; * * * else *h1_ptr = (*h1_ptr)->next = *h; * * }else{ * * * if(h2==NULL) h2 = *h2_ptr = *h; * * * else *h2_ptr = (*h2_ptr)->next = *h; * * } * * *h = (*h)->next; * } * (*h1_ptr)->next = (*h2_ptr)->next = NULL; * *h1_ptr = h1; * *h2_ptr = h2; * *h = NULL; } void help(){ * printf("0.µ≤ßÙ\n"); * printf("1.Insert\n"); * printf("2.Delete\n"); * printf("3.Search\n"); * printf("4.Count\n"); * printf("5.Reverse\n"); * printf("6.Merge\n"); * printf("7.Split\n"); * printf("8.help\n"); }

Slide 41

Slide 41 text

/*¶®•\§jæ«∏Í∞T§uµ{æ«®t98Ø≈§AØZ≤¶•…¨u æ«∏π°GF74942294*/ / ****************************************************************************** * FileName: hw7_s.c Programmer: CrBoy Purpose: ≥–≥y§@≠”singly linked list®√∞ı¶Ê¶U∫ÿ•\؇ Input: Output: the standard out Compilation: gcc hw7_s.c -o hw7_s Run: ./hw7_s Date: 2006/1/8 / ****************************************************************************** / #include struct node{ * int data; * struct node *next; }; typedef struct node node; void print_list(node*);/*print_list(h); ¶C¶L•Hh∂}¿Y™∫linked list*/ node *Insert(int, node*);/*Insert(data, h); ¶b•Hh∂}¿Y™∫linked list§§¥ °§Jdata®√¶^∂«∑s™∫h*/ node *Delete(int, node*);/*Delete(data, h); ¶b•Hh∂}¿Y™∫linked list§§ßR∞ £data®√¶^∂«∑s™∫h*/ node *Search(int, node*);/*Search(data, h); ¶b•Hh∂}¿Y™∫linked list§§¥Mß ‰data®√∂«¶^data©“¶b™∫¶Ï∏m*/ int Count(node*);/*Count(h); ≠p∫‚•Hh∂}¿Y™∫linked list§§™∫∏`¬I≠”º∆*/ node *Reverse(node*);/*Reverse(h); §œß«±∆¶C•Hh∂}¿Y™∫linked list®√∂«¶^∑s™∫h*/ node *Merge(node*, node*);/*Merge(h1, h2); ¶X®÷h1ªPh2≥o2≠”linked list®√¶^∂«¶X®÷´·™∫™∫head*/ void Split(node**, node**, node**);/*Split(&h, &h1, &h2); §¿≥Œh≥o≠”linked list¨∞©_∞∏º∆®√§¿ßO¶s®Ïh1ªPh2§§*/ void help(); int order=1; int main(void){ ! node *h1=NULL, *h2=NULL; ! while(*h!=NULL){ ! ! if((*h)->data%2){ ! ! ! if(h1==NULL) h1 = *h1_ptr = *h; ! ! ! else *h1_ptr = (*h1_ptr)->next = *h; ! ! }else{ ! ! ! if(h2==NULL) h2 = *h2_ptr = *h; ! ! ! else *h2_ptr = (*h2_ptr)->next = *h; ! ! } ! ! *h = (*h)->next; ! } ! (*h1_ptr)->next = (*h2_ptr)->next = NULL; ! *h1_ptr = h1; ! *h2_ptr = h2; ! *h = NULL; * int sel=8, data=0; * node *h=NULL, *h1=NULL, *h2=NULL; * help(); * while(sel){ * * printf("\n•ÿ´e™∫Linked list°G"); * * print_list(h); * * printf("Ω–øÔæ‹•\\؇°G"); * * if(scanf("%d", &sel)==0){ * * * sel=-1; * * * fflush(stdin); * * } * * switch(sel){ * * * case 0: break; * * * case 1: * * * * printf("Ω–øÈ§J±˝¥°§J™∫愺∆≠»°G"); * * * * if(scanf("%d", &data)==0) continue; * * * * if(order) * * * * * h = Insert(data, h); * * * * else{ * * * * * h = Reverse(h); * * * * * h = Insert(data, h); * * * * * h = Reverse(h); * * * * } * * * * break; * * * case 2: * * * * printf("Ω–øÈ§J±˝ßR∞£™∫愺∆≠»°G"); * * * * if(scanf("%d", &data)==0) continue; * * * * if(order) * * * * * h = Delete(data, h); * * * * else{ * * * * * h = Reverse(h); * * * * * h = Delete(data, h); * * * * * h = Reverse(h); * * * * } * * * * break; * * * case 3: * * * * printf("Ω–øÈ§J±˝∑j¥M™∫愺∆≠»°G"); * * * * if(scanf("%d", &data)==0) continue; * * * * h1 = Search(data, h); * * * * printf("•H%dß@¨∞∞_¬I™∫Linked list°G", data); * * * * print_list(h1); * * * * h1 = NULL; * * * * break; * * * case 4: * * * * printf("•ÿ´e™∫Linked list¶@¶≥%d≠”node °C\n", Count(h)); * * * * break; * * * case 5: * * * * h = Reverse(h); * * * * break; * * * case 6: * * * * printf("h1°G"); * * * * print_list(h1); * * * * printf("h2°G"); * * * * print_list(h2); * * * * h = Merge(h1, h2); * * * * h1 = h2 = NULL; * * * * break; * * * case 7: * * * * if(order) Split(&h, &h1, &h2); * * * * else{ * * * * * h = Reverse(h); * * * * * Split(&h, &h1, &h2); * * * * } * * * * printf("h1°G"); * * * * print_list(h1); * * * * printf("h2°G"); * * * * print_list(h2); * * * * break; * * * default: printf("±z™∫øÈ§J¶≥ª~°I\n"); * * * case 8: help(); * * } * } ! temp = (node*)malloc(sizeof(node)); ! temp->data = data; ! temp->next = p->next; ! p->next = temp; * return 0; } void print_list(node *h){ * node *temp; * temp = h; * while(temp != NULL){ * * printf("%d -> ", temp->data); * * temp = temp->next; * } * printf("NULL\n"); } node *Insert(int data, node *h){ * node *p, *t, *temp; * if(h==NULL){ * * temp = (node*)malloc(sizeof(node)); * * temp->data = data; * * temp->next = NULL; * * return temp; * } * p = h; * t = h->next; * if(datadata){ * * temp = (node*)malloc(sizeof(node)); * * temp->data = data; * * temp->next = p; * * return temp; * } * if(t!=NULL) * * while(datadata || data>t->data){ * * * p = p->next; * * * t = t->next; * * * if(t==NULL) break; * * } * temp = (node*)malloc(sizeof(node)); * temp->data = data; * temp->next = p->next; * p->next = temp; * return h; } node *Delete(int data, node *h){ * node *p, *t; * if(h==NULL) return h; * p = h; * t = h->next; * if(data == p->data){ * * p = p->next; * * free(h); * * return p; * } * while(data!=t->data){ * * p = p->next; * * t = t->next; * * if(t==NULL) return h; * } * p->next = t->next; * free(t); * return h; } node *Search(int data, node *h){ * node *p=h; * while(p!=NULL && data!=p->data)* p = p->next; * return p; } int Count(node *h){ * int count=0; * while(h!=NULL){ * * count += 1; * * h = h->next; * } * return count; } node *Reverse(node *h){ * node *a, *b, *c; * if(h==NULL || h->next==NULL) return h; * a = h; * b = a->next; * c = b->next; * a->next = NULL; * while(c!=NULL){ * * b->next = a; * * a = b; * * b = c; * * c = c->next; * } * b->next = a; * order = !order; * return b; } node *Merge(node *h1, node *h2){ * node *h, *temp; * h = temp = h1->data < h2->data ? h1 : h2; * h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); * while(h1!=NULL && h2!=NULL){ * * temp = temp->next = h1->data < h2->data ? h1 : h2; * * h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); * } * h2 == NULL ? (temp->next=h1) : (temp->next=h2); * return h; } void Split(node **h, node **h1_ptr, node **h2_ptr){ * node *h1=NULL, *h2=NULL; * while(*h!=NULL){ * * if((*h)->data%2){ * * * if(h1==NULL) h1 = *h1_ptr = *h; * * * else *h1_ptr = (*h1_ptr)->next = *h; * * }else{ * * * if(h2==NULL) h2 = *h2_ptr = *h; * * * else *h2_ptr = (*h2_ptr)->next = *h; * * } * * *h = (*h)->next; * } * (*h1_ptr)->next = (*h2_ptr)->next = NULL; * *h1_ptr = h1; * *h2_ptr = h2; * *h = NULL; } void help(){ * printf("0.µ≤ßÙ\n"); * printf("1.Insert\n"); * printf("2.Delete\n"); * printf("3.Search\n"); * printf("4.Count\n"); * printf("5.Reverse\n"); * printf("6.Merge\n"); * printf("7.Split\n"); * printf("8.help\n"); } อᄣl อᄣl

Slide 42

Slide 42 text

/*¶®•\§jæ«∏Í∞T§uµ{æ«®t98Ø≈§AØZ≤¶•…¨u æ«∏π°GF74942294*/ / ****************************************************************************** * FileName: hw7_s.c Programmer: CrBoy Purpose: ≥–≥y§@≠”singly linked list®√∞ı¶Ê¶U∫ÿ•\؇ Input: Output: the standard out Compilation: gcc hw7_s.c -o hw7_s Run: ./hw7_s Date: 2006/1/8 / ****************************************************************************** / #include struct node{ * int data; * struct node *next; }; typedef struct node node; void print_list(node*);/*print_list(h); ¶C¶L•Hh∂}¿Y™∫linked list*/ node *Insert(int, node*);/*Insert(data, h); ¶b•Hh∂}¿Y™∫linked list§§¥ °§Jdata®√¶^∂«∑s™∫h*/ node *Delete(int, node*);/*Delete(data, h); ¶b•Hh∂}¿Y™∫linked list§§ßR∞ £data®√¶^∂«∑s™∫h*/ node *Search(int, node*);/*Search(data, h); ¶b•Hh∂}¿Y™∫linked list§§¥Mß ‰data®√∂«¶^data©“¶b™∫¶Ï∏m*/ int Count(node*);/*Count(h); ≠p∫‚•Hh∂}¿Y™∫linked list§§™∫∏`¬I≠”º∆*/ node *Reverse(node*);/*Reverse(h); §œß«±∆¶C•Hh∂}¿Y™∫linked list®√∂«¶^∑s™∫h*/ node *Merge(node*, node*);/*Merge(h1, h2); ¶X®÷h1ªPh2≥o2≠”linked list®√¶^∂«¶X®÷´·™∫™∫head*/ void Split(node**, node**, node**);/*Split(&h, &h1, &h2); §¿≥Œh≥o≠”linked list¨∞©_∞∏º∆®√§¿ßO¶s®Ïh1ªPh2§§*/ void help(); int order=1; int main(void){ ! node *h1=NULL, *h2=NULL; ! while(*h!=NULL){ ! ! if((*h)->data%2){ ! ! ! if(h1==NULL) h1 = *h1_ptr = *h; ! ! ! else *h1_ptr = (*h1_ptr)->next = *h; ! ! }else{ ! ! ! if(h2==NULL) h2 = *h2_ptr = *h; ! ! ! else *h2_ptr = (*h2_ptr)->next = *h; ! ! } ! ! *h = (*h)->next; ! } ! (*h1_ptr)->next = (*h2_ptr)->next = NULL; ! *h1_ptr = h1; ! *h2_ptr = h2; ! *h = NULL; * int sel=8, data=0; * node *h=NULL, *h1=NULL, *h2=NULL; * help(); * while(sel){ * * printf("\n•ÿ´e™∫Linked list°G"); * * print_list(h); * * printf("Ω–øÔæ‹•\\؇°G"); * * if(scanf("%d", &sel)==0){ * * * sel=-1; * * * fflush(stdin); * * } * * switch(sel){ * * * case 0: break; * * * case 1: * * * * printf("Ω–øÈ§J±˝¥°§J™∫愺∆≠»°G"); * * * * if(scanf("%d", &data)==0) continue; * * * * if(order) * * * * * h = Insert(data, h); * * * * else{ * * * * * h = Reverse(h); * * * * * h = Insert(data, h); * * * * * h = Reverse(h); * * * * } * * * * break; * * * case 2: * * * * printf("Ω–øÈ§J±˝ßR∞£™∫愺∆≠»°G"); * * * * if(scanf("%d", &data)==0) continue; * * * * if(order) * * * * * h = Delete(data, h); * * * * else{ * * * * * h = Reverse(h); * * * * * h = Delete(data, h); * * * * * h = Reverse(h); * * * * } * * * * break; * * * case 3: * * * * printf("Ω–øÈ§J±˝∑j¥M™∫愺∆≠»°G"); * * * * if(scanf("%d", &data)==0) continue; * * * * h1 = Search(data, h); * * * * printf("•H%dß@¨∞∞_¬I™∫Linked list°G", data); * * * * print_list(h1); * * * * h1 = NULL; * * * * break; * * * case 4: * * * * printf("•ÿ´e™∫Linked list¶@¶≥%d≠”node °C\n", Count(h)); * * * * break; * * * case 5: * * * * h = Reverse(h); * * * * break; * * * case 6: * * * * printf("h1°G"); * * * * print_list(h1); * * * * printf("h2°G"); * * * * print_list(h2); * * * * h = Merge(h1, h2); * * * * h1 = h2 = NULL; * * * * break; * * * case 7: * * * * if(order) Split(&h, &h1, &h2); * * * * else{ * * * * * h = Reverse(h); * * * * * Split(&h, &h1, &h2); * * * * } * * * * printf("h1°G"); * * * * print_list(h1); * * * * printf("h2°G"); * * * * print_list(h2); * * * * break; * * * default: printf("±z™∫øÈ§J¶≥ª~°I\n"); * * * case 8: help(); * * } * } ! temp = (node*)malloc(sizeof(node)); ! temp->data = data; ! temp->next = p->next; ! p->next = temp; * return 0; } void print_list(node *h){ * node *temp; * temp = h; * while(temp != NULL){ * * printf("%d -> ", temp->data); * * temp = temp->next; * } * printf("NULL\n"); } node *Insert(int data, node *h){ * node *p, *t, *temp; * if(h==NULL){ * * temp = (node*)malloc(sizeof(node)); * * temp->data = data; * * temp->next = NULL; * * return temp; * } * p = h; * t = h->next; * if(datadata){ * * temp = (node*)malloc(sizeof(node)); * * temp->data = data; * * temp->next = p; * * return temp; * } * if(t!=NULL) * * while(datadata || data>t->data){ * * * p = p->next; * * * t = t->next; * * * if(t==NULL) break; * * } * temp = (node*)malloc(sizeof(node)); * temp->data = data; * temp->next = p->next; * p->next = temp; * return h; } node *Delete(int data, node *h){ * node *p, *t; * if(h==NULL) return h; * p = h; * t = h->next; * if(data == p->data){ * * p = p->next; * * free(h); * * return p; * } * while(data!=t->data){ * * p = p->next; * * t = t->next; * * if(t==NULL) return h; * } * p->next = t->next; * free(t); * return h; } node *Search(int data, node *h){ * node *p=h; * while(p!=NULL && data!=p->data)* p = p->next; * return p; } int Count(node *h){ * int count=0; * while(h!=NULL){ * * count += 1; * * h = h->next; * } * return count; } node *Reverse(node *h){ * node *a, *b, *c; * if(h==NULL || h->next==NULL) return h; * a = h; * b = a->next; * c = b->next; * a->next = NULL; ! while(c!=NULL){ ! ! b->next = a; ! ! a = b; ! ! b = c; ! ! c = c->next; ! } * b->next = a; * order = !order; * return b; } node *Merge(node *h1, node *h2){ * node *h, *temp; * h = temp = h1->data < h2->data ? h1 : h2; * h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); * while(h1!=NULL && h2!=NULL){ * * temp = temp->next = h1->data < h2->data ? h1 : h2; * * h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); * } ! while(c!=NULL){ ! ! b->next = a; ! ! a = b; ! ! b = c; ! ! c = c->next; ! } * h2 == NULL ? (temp->next=h1) : (temp->next=h2); * return h; } void Split(node **h, node **h1_ptr, node **h2_ptr){ * node *h1=NULL, *h2=NULL; * while(*h!=NULL){ * * if((*h)->data%2){ * * * if(h1==NULL) h1 = *h1_ptr = *h; * * * else *h1_ptr = (*h1_ptr)->next = *h; * * }else{ * * * if(h2==NULL) h2 = *h2_ptr = *h; * * * else *h2_ptr = (*h2_ptr)->next = *h; * * } * * *h = (*h)->next; * } * (*h1_ptr)->next = (*h2_ptr)->next = NULL; * *h1_ptr = h1; * *h2_ptr = h2; * *h = NULL; } void help(){ * printf("0.µ≤ßÙ\n"); * printf("1.Insert\n"); * printf("2.Delete\n"); * printf("3.Search\n"); * printf("4.Count\n"); * printf("5.Reverse\n"); * printf("6.Merge\n"); * printf("7.Split\n"); * printf("8.help\n"); } อᄣl мৰl

Slide 43

Slide 43 text

/*¶®•\§jæ«∏Í∞T§uµ{æ«®t98Ø≈§AØZ≤¶•…¨u æ«∏π°GF74942294*/ / ****************************************************************************** * FileName: hw7_s.c Programmer: CrBoy Purpose: ≥–≥y§@≠”singly linked list®√∞ı¶Ê¶U∫ÿ•\؇ Input: Output: the standard out Compilation: gcc hw7_s.c -o hw7_s Run: ./hw7_s Date: 2006/1/8 / ****************************************************************************** / #include struct node{ * int data; * struct node *next; }; typedef struct node node; void print_list(node*);/*print_list(h); ¶C¶L•Hh∂}¿Y™∫linked list*/ node *Insert(int, node*);/*Insert(data, h); ¶b•Hh∂}¿Y™∫linked list§§¥ °§Jdata®√¶^∂«∑s™∫h*/ node *Delete(int, node*);/*Delete(data, h); ¶b•Hh∂}¿Y™∫linked list§§ßR∞ £data®√¶^∂«∑s™∫h*/ node *Search(int, node*);/*Search(data, h); ¶b•Hh∂}¿Y™∫linked list§§¥Mß ‰data®√∂«¶^data©“¶b™∫¶Ï∏m*/ int Count(node*);/*Count(h); ≠p∫‚•Hh∂}¿Y™∫linked list§§™∫∏`¬I≠”º∆*/ node *Reverse(node*);/*Reverse(h); §œß«±∆¶C•Hh∂}¿Y™∫linked list®√∂«¶^∑s™∫h*/ node *Merge(node*, node*);/*Merge(h1, h2); ¶X®÷h1ªPh2≥o2≠”linked list®√¶^∂«¶X®÷´·™∫™∫head*/ void Split(node**, node**, node**);/*Split(&h, &h1, &h2); §¿≥Œh≥o≠”linked list¨∞©_∞∏º∆®√§¿ßO¶s®Ïh1ªPh2§§*/ void help(); int order=1; int main(void){ ! node *h1=NULL, *h2=NULL; ! while(*h!=NULL){ ! ! if((*h)->data%2){ ! ! ! if(h1==NULL) h1 = *h1_ptr = *h; ! ! ! else *h1_ptr = (*h1_ptr)->next = *h; ! ! }else{ ! ! ! if(h2==NULL) h2 = *h2_ptr = *h; ! ! ! else *h2_ptr = (*h2_ptr)->next = *h; ! ! } ! ! *h = (*h)->next; ! } ! (*h1_ptr)->next = (*h2_ptr)->next = NULL; ! *h1_ptr = h1; ! *h2_ptr = h2; ! *h = NULL; * int sel=8, data=0; * node *h=NULL, *h1=NULL, *h2=NULL; * help(); * while(sel){ * * printf("\n•ÿ´e™∫Linked list°G"); * * print_list(h); * * printf("Ω–øÔæ‹•\\؇°G"); * * if(scanf("%d", &sel)==0){ * * * sel=-1; * * * fflush(stdin); * * } * * switch(sel){ * * * case 0: break; ! ! ! case 1: ! ! ! ! printf("Ω–øÈ§J±˝¥°§J™∫愺∆≠»°G"); ! ! ! ! if(scanf("%d", &data)==0) continue; ! ! ! ! if(order) ! ! ! ! ! h = Insert(data, h); ! ! ! ! else{ ! ! ! ! ! h = Reverse(h); ! ! ! ! ! h = Insert(data, h); ! ! ! ! ! h = Reverse(h); ! ! ! ! } ! ! ! ! break; ! ! ! case 2: ! ! ! ! printf("Ω–øÈ§J±˝ßR∞£™∫愺∆≠»°G"); ! ! ! ! if(scanf("%d", &data)==0) continue; ! ! ! ! if(order) ! ! ! ! ! h = Delete(data, h); ! ! ! ! else{ ! ! ! ! ! h = Reverse(h); ! ! ! ! ! h = Delete(data, h); ! ! ! ! ! h = Reverse(h); ! ! ! ! } ! ! ! ! break; * * * case 3: * * * * printf("Ω–øÈ§J±˝∑j¥M™∫愺∆≠»°G"); * * * * if(scanf("%d", &data)==0) continue; * * * * h1 = Search(data, h); * * * * printf("•H%dß@¨∞∞_¬I™∫Linked list°G", data); * * * * print_list(h1); * * * * h1 = NULL; * * * * break; * * * case 4: * * * * printf("•ÿ´e™∫Linked list¶@¶≥%d≠”node °C\n", Count(h)); * * * * break; * * * case 5: * * * * h = Reverse(h); * * * * break; * * * case 6: * * * * printf("h1°G"); * * * * print_list(h1); * * * * printf("h2°G"); * * * * print_list(h2); * * * * h = Merge(h1, h2); * * * * h1 = h2 = NULL; * * * * break; * * * case 7: * * * * if(order) Split(&h, &h1, &h2); * * * * else{ * * * * * h = Reverse(h); * * * * * Split(&h, &h1, &h2); * * * * } * * * * printf("h1°G"); * * * * print_list(h1); * * * * printf("h2°G"); * * * * print_list(h2); * * * * break; * * * default: printf("±z™∫øÈ§J¶≥ª~°I\n"); * * * case 8: help(); * * } * } ! temp = (node*)malloc(sizeof(node)); ! temp->data = data; ! temp->next = p->next; ! p->next = temp; * return 0; } void print_list(node *h){ * node *temp; * temp = h; * while(temp != NULL){ * * printf("%d -> ", temp->data); * * temp = temp->next; * } * printf("NULL\n"); } node *Insert(int data, node *h){ * node *p, *t, *temp; * if(h==NULL){ * * temp = (node*)malloc(sizeof(node)); * * temp->data = data; * * temp->next = NULL; * * return temp; * } * p = h; ! (*h1_ptr)->next = (*h2_ptr)->next = NULL; ! *h1_ptr = h1; ! *h2_ptr = h2; ! *h = NULL; * t = h->next; * if(datadata){ * * temp = (node*)malloc(sizeof(node)); * * temp->data = data; * * temp->next = p; * * return temp; * } * if(t!=NULL) * * while(datadata || data>t->data){ * * * p = p->next; * * * t = t->next; * * * if(t==NULL) break; * * } * temp = (node*)malloc(sizeof(node)); * temp->data = data; * temp->next = p->next; * p->next = temp; ! node *h=NULL, *h1=NULL, *h2=NULL; ! help(); * return h; } node *Delete(int data, node *h){ * node *p, *t; * if(h==NULL) return h; * p = h; * t = h->next; * if(data == p->data){ * * p = p->next; * * free(h); * * return p; * } * while(data!=t->data){ * * p = p->next; * * t = t->next; * * if(t==NULL) return h; * } * p->next = t->next; * free(t); * return h; } node *Search(int data, node *h){ ! node *p=h; ! while(p!=NULL && data!=p->data)! p = p->next; ! return p; } int Count(node *h){ ! int count=0; ! while(h!=NULL){ ! ! count += 1; ! ! h = h->next; ! } ! return count; } node *Reverse(node *h){ * node *a, *b, *c; * if(h==NULL || h->next==NULL) return h; * a = h; * b = a->next; * c = b->next; * a->next = NULL; ! while(c!=NULL){ ! ! b->next = a; ! ! a = b; ! ! b = c; ! ! c = c->next; ! } * b->next = a; * order = !order; * return b; } node *Merge(node *h1, node *h2){ * node *h, *temp; * h = temp = h1->data < h2->data ? h1 : h2; * h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); * while(h1!=NULL && h2!=NULL){ * * temp = temp->next = h1->data < h2->data ? h1 : h2; * * h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); * } ! while(c!=NULL){ ! ! b->next = a; ! ! a = b; ! ! b = c; ! ! c = c->next; ! } * h2 == NULL ? (temp->next=h1) : (temp->next=h2); * return h; } void Split(node **h, node **h1_ptr, node **h2_ptr){ * node *h1=NULL, *h2=NULL; * while(*h!=NULL){ * * if((*h)->data%2){ * * * if(h1==NULL) h1 = *h1_ptr = *h; * * * else *h1_ptr = (*h1_ptr)->next = *h; * * }else{ * * * if(h2==NULL) h2 = *h2_ptr = *h; * * * else *h2_ptr = (*h2_ptr)->next = *h; * * } * * *h = (*h)->next; * } * (*h1_ptr)->next = (*h2_ptr)->next = NULL; * *h1_ptr = h1; * *h2_ptr = h2; * *h = NULL; } void help(){ * printf("0.µ≤ßÙ\n"); * printf("1.Insert\n"); * printf("2.Delete\n"); * printf("3.Search\n"); * printf("4.Count\n"); * printf("5.Reverse\n"); * printf("6.Merge\n"); * printf("7.Split\n"); * printf("8.help\n"); } อᄣl мৰl мৰl

Slide 44

Slide 44 text

/*¶®•\§jæ«∏Í∞T§uµ{æ«®t98Ø≈§AØZ≤¶•…¨u æ«∏π°GF74942294*/ / ****************************************************************************** * FileName: hw7_s.c Programmer: CrBoy Purpose: ≥–≥y§@≠”singly linked list®√∞ı¶Ê¶U∫ÿ•\؇ Input: Output: the standard out Compilation: gcc hw7_s.c -o hw7_s Run: ./hw7_s Date: 2006/1/8 / ****************************************************************************** / #include struct node{ * int data; * struct node *next; }; typedef struct node node; void print_list(node*);/*print_list(h); ¶C¶L•Hh∂}¿Y™∫linked list*/ node *Insert(int, node*);/*Insert(data, h); ¶b•Hh∂}¿Y™∫linked list§§¥ °§Jdata®√¶^∂«∑s™∫h*/ node *Delete(int, node*);/*Delete(data, h); ¶b•Hh∂}¿Y™∫linked list§§ßR∞ £data®√¶^∂«∑s™∫h*/ node *Search(int, node*);/*Search(data, h); ¶b•Hh∂}¿Y™∫linked list§§¥Mß ‰data®√∂«¶^data©“¶b™∫¶Ï∏m*/ int Count(node*);/*Count(h); ≠p∫‚•Hh∂}¿Y™∫linked list§§™∫∏`¬I≠”º∆*/ node *Reverse(node*);/*Reverse(h); §œß«±∆¶C•Hh∂}¿Y™∫linked list®√∂«¶^∑s™∫h*/ node *Merge(node*, node*);/*Merge(h1, h2); ¶X®÷h1ªPh2≥o2≠”linked list®√¶^∂«¶X®÷´·™∫™∫head*/ void Split(node**, node**, node**);/*Split(&h, &h1, &h2); §¿≥Œh≥o≠”linked list¨∞©_∞∏º∆®√§¿ßO¶s®Ïh1ªPh2§§*/ void help(); int order=1; int main(void){ ! node *h1=NULL, *h2=NULL; ! while(*h!=NULL){ ! ! if((*h)->data%2){ ! ! ! if(h1==NULL) h1 = *h1_ptr = *h; ! ! ! else *h1_ptr = (*h1_ptr)->next = *h; ! ! }else{ ! ! ! if(h2==NULL) h2 = *h2_ptr = *h; ! ! ! else *h2_ptr = (*h2_ptr)->next = *h; ! ! } ! ! *h = (*h)->next; ! } ! (*h1_ptr)->next = (*h2_ptr)->next = NULL; ! *h1_ptr = h1; ! *h2_ptr = h2; ! *h = NULL; * int sel=8, data=0; * node *h=NULL, *h1=NULL, *h2=NULL; * help(); * while(sel){ * * printf("\n•ÿ´e™∫Linked list°G"); * * print_list(h); * * printf("Ω–øÔæ‹•\\؇°G"); * * if(scanf("%d", &sel)==0){ * * * sel=-1; * * * fflush(stdin); * * } * * switch(sel){ * * * case 0: break; ! ! ! case 1: ! ! ! ! printf("Ω–øÈ§J±˝¥°§J™∫愺∆≠»°G"); ! ! ! ! if(scanf("%d", &data)==0) continue; ! ! ! ! if(order) ! ! ! ! ! h = Insert(data, h); ! ! ! ! else{ ! ! ! ! ! h = Reverse(h); ! ! ! ! ! h = Insert(data, h); ! ! ! ! ! h = Reverse(h); ! ! ! ! } ! ! ! ! break; ! ! ! case 2: ! ! ! ! printf("Ω–øÈ§J±˝ßR∞£™∫愺∆≠»°G"); ! ! ! ! if(scanf("%d", &data)==0) continue; ! ! ! ! if(order) ! ! ! ! ! h = Delete(data, h); ! ! ! ! else{ ! ! ! ! ! h = Reverse(h); ! ! ! ! ! h = Delete(data, h); ! ! ! ! ! h = Reverse(h); ! ! ! ! } ! ! ! ! break; * * * case 3: * * * * printf("Ω–øÈ§J±˝∑j¥M™∫愺∆≠»°G"); * * * * if(scanf("%d", &data)==0) continue; * * * * h1 = Search(data, h); * * * * printf("•H%dß@¨∞∞_¬I™∫Linked list°G", data); * * * * print_list(h1); * * * * h1 = NULL; * * * * break; * * * case 4: * * * * printf("•ÿ´e™∫Linked list¶@¶≥%d≠”node °C\n", Count(h)); * * * * break; * * * case 5: * * * * h = Reverse(h); * * * * break; * * * case 6: * * * * printf("h1°G"); * * * * print_list(h1); * * * * printf("h2°G"); * * * * print_list(h2); * * * * h = Merge(h1, h2); * * * * h1 = h2 = NULL; * * * * break; * * * case 7: * * * * if(order) Split(&h, &h1, &h2); * * * * else{ * * * * * h = Reverse(h); * * * * * Split(&h, &h1, &h2); * * * * } * * * * printf("h1°G"); * * * * print_list(h1); * * * * printf("h2°G"); * * * * print_list(h2); * * * * break; * * * default: printf("±z™∫øÈ§J¶≥ª~°I\n"); * * * case 8: help(); * * } * } ! temp = (node*)malloc(sizeof(node)); ! temp->data = data; ! temp->next = p->next; ! p->next = temp; * return 0; } void print_list(node *h){ * node *temp; * temp = h; * while(temp != NULL){ * * printf("%d -> ", temp->data); * * temp = temp->next; * } * printf("NULL\n"); } node *Insert(int data, node *h){ * node *p, *t, *temp; * if(h==NULL){ * * temp = (node*)malloc(sizeof(node)); * * temp->data = data; * * temp->next = NULL; * * return temp; * } * p = h; ! (*h1_ptr)->next = (*h2_ptr)->next = NULL; ! *h1_ptr = h1; ! *h2_ptr = h2; ! *h = NULL; * t = h->next; * if(datadata){ * * temp = (node*)malloc(sizeof(node)); * * temp->data = data; * * temp->next = p; * * return temp; * } * if(t!=NULL) * * while(datadata || data>t->data){ * * * p = p->next; * * * t = t->next; * * * if(t==NULL) break; * * } * temp = (node*)malloc(sizeof(node)); * temp->data = data; * temp->next = p->next; * p->next = temp; ! node *h=NULL, *h1=NULL, *h2=NULL; ! help(); * return h; } node *Delete(int data, node *h){ * node *p, *t; * if(h==NULL) return h; * p = h; * t = h->next; * if(data == p->data){ * * p = p->next; * * free(h); * * return p; * } * while(data!=t->data){ * * p = p->next; * * t = t->next; * * if(t==NULL) return h; * } * p->next = t->next; * free(t); * return h; } node *Search(int data, node *h){ ! node *p=h; ! while(p!=NULL && data!=p->data)! p = p->next; ! return p; } int Count(node *h){ ! int count=0; ! while(h!=NULL){ ! ! count += 1; ! ! h = h->next; ! } ! return count; } node *Reverse(node *h){ * node *a, *b, *c; * if(h==NULL || h->next==NULL) return h; * a = h; * b = a->next; * c = b->next; * a->next = NULL; ! while(c!=NULL){ ! ! b->next = a; ! ! a = b; ! ! b = c; ! ! c = c->next; ! } * b->next = a; * order = !order; * return b; } node *Merge(node *h1, node *h2){ * node *h, *temp; * h = temp = h1->data < h2->data ? h1 : h2; * h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); * while(h1!=NULL && h2!=NULL){ * * temp = temp->next = h1->data < h2->data ? h1 : h2; * * h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); * } ! while(c!=NULL){ ! ! b->next = a; ! ! a = b; ! ! b = c; ! ! c = c->next; ! } * h2 == NULL ? (temp->next=h1) : (temp->next=h2); * return h; } void Split(node **h, node **h1_ptr, node **h2_ptr){ * node *h1=NULL, *h2=NULL; * while(*h!=NULL){ * * if((*h)->data%2){ * * * if(h1==NULL) h1 = *h1_ptr = *h; * * * else *h1_ptr = (*h1_ptr)->next = *h; * * }else{ * * * if(h2==NULL) h2 = *h2_ptr = *h; * * * else *h2_ptr = (*h2_ptr)->next = *h; * * } * * *h = (*h)->next; * } * (*h1_ptr)->next = (*h2_ptr)->next = NULL; * *h1_ptr = h1; * *h2_ptr = h2; * *h = NULL; } void print_list(node *h){ ! node *temp; ! temp = h; ! while(temp != NULL){ ! ! printf("%d -> ", temp->data); ! ! temp = temp->next; ! } ! printf("NULL\n"); } void help(){ * printf("0.µ≤ßÙ\n"); * printf("1.Insert\n"); * printf("2.Delete\n"); * printf("3.Search\n"); * printf("4.Count\n"); * printf("5.Reverse\n"); * printf("6.Merge\n"); * printf("7.Split\n"); * printf("8.help\n"); อᄣl мৰl

Slide 45

Slide 45 text

ЫڀəՇ˂

Slide 46

Slide 46 text

ഐ؈̌ঐᄳᙻə

Slide 47

Slide 47 text

ɦڀՇ˂Ҫ$0%&ҷΫԸ

Slide 48

Slide 48 text

/*¶®•\§jæ«∏Í∞T§uµ{æ«®t98Ø≈§AØZ≤¶•…¨u æ«∏π°GF74942294*/ / ****************************************************************************** * FileName: hw7_s.c Programmer: CrBoy Purpose: ≥–≥y§@≠”singly linked list®√∞ı¶Ê¶U∫ÿ•\؇ Input: Output: the standard out Compilation: gcc hw7_s.c -o hw7_s Run: ./hw7_s Date: 2006/1/8 / ****************************************************************************** / #include struct node{ * int data; * struct node *next; }; typedef struct node node; void print_list(node*);/*print_list(h); ¶C¶L•Hh∂}¿Y™∫linked list*/ node *Insert(int, node*);/*Insert(data, h); ¶b•Hh∂}¿Y™∫linked list§§¥ °§Jdata®√¶^∂«∑s™∫h*/ node *Delete(int, node*);/*Delete(data, h); ¶b•Hh∂}¿Y™∫linked list§§ßR∞ £data®√¶^∂«∑s™∫h*/ node *Search(int, node*);/*Search(data, h); ¶b•Hh∂}¿Y™∫linked list§§¥Mß ‰data®√∂«¶^data©“¶b™∫¶Ï∏m*/ int Count(node*);/*Count(h); ≠p∫‚•Hh∂}¿Y™∫linked list§§™∫∏`¬I≠”º∆*/ node *Reverse(node*);/*Reverse(h); §œß«±∆¶C•Hh∂}¿Y™∫linked list®√∂«¶^∑s™∫h*/ node *Merge(node*, node*);/*Merge(h1, h2); ¶X®÷h1ªPh2≥o2≠”linked list®√¶^∂«¶X®÷´·™∫™∫head*/ void Split(node**, node**, node**);/*Split(&h, &h1, &h2); §¿≥Œh≥o≠”linked list¨∞©_∞∏º∆®√§¿ßO¶s®Ïh1ªPh2§§*/ void help(); int order=1; int main(void){ ! node *h1=NULL, *h2=NULL; ! while(*h!=NULL){ ! ! if((*h)->data%2){ ! ! ! if(h1==NULL) h1 = *h1_ptr = *h; ! ! ! else *h1_ptr = (*h1_ptr)->next = *h; ! ! }else{ ! ! ! if(h2==NULL) h2 = *h2_ptr = *h; ! ! ! else *h2_ptr = (*h2_ptr)->next = *h; ! ! } ! ! *h = (*h)->next; ! } ! (*h1_ptr)->next = (*h2_ptr)->next = NULL; ! *h1_ptr = h1; ! *h2_ptr = h2; ! *h = NULL; * int sel=8, data=0; * node *h=NULL, *h1=NULL, *h2=NULL; * help(); * while(sel){ * * printf("\n•ÿ´e™∫Linked list°G"); * * print_list(h); * * printf("Ω–øÔæ‹•\\؇°G"); * * if(scanf("%d", &sel)==0){ * * * sel=-1; * * * fflush(stdin); * * } * * switch(sel){ * * * case 0: break; ! ! ! case 1: ! ! ! ! printf("Ω–øÈ§J±˝¥°§J™∫愺∆≠»°G"); ! ! ! ! if(scanf("%d", &data)==0) continue; ! ! ! ! if(order) ! ! ! ! ! h = Insert(data, h); ! ! ! ! else{ ! ! ! ! ! h = Reverse(h); ! ! ! ! ! h = Insert(data, h); ! ! ! ! ! h = Reverse(h); ! ! ! ! } ! ! ! ! break; ! ! ! case 2: ! ! ! ! printf("Ω–øÈ§J±˝ßR∞£™∫愺∆≠»°G"); ! ! ! ! if(scanf("%d", &data)==0) continue; ! ! ! ! if(order) ! ! ! ! ! h = Delete(data, h); ! ! ! ! else{ ! ! ! ! ! h = Reverse(h); ! ! ! ! ! h = Delete(data, h); ! ! ! ! ! h = Reverse(h); ! ! ! ! } ! ! ! ! break; * * * case 3: * * * * printf("Ω–øÈ§J±˝∑j¥M™∫愺∆≠»°G"); * * * * if(scanf("%d", &data)==0) continue; * * * * h1 = Search(data, h); * * * * printf("•H%dß@¨∞∞_¬I™∫Linked list°G", data); * * * * print_list(h1); * * * * h1 = NULL; * * * * break; * * * case 4: * * * * printf("•ÿ´e™∫Linked list¶@¶≥%d≠”node °C\n", Count(h)); * * * * break; * * * case 5: * * * * h = Reverse(h); * * * * break; * * * case 6: * * * * printf("h1°G"); * * * * print_list(h1); * * * * printf("h2°G"); * * * * print_list(h2); * * * * h = Merge(h1, h2); * * * * h1 = h2 = NULL; * * * * break; * * * case 7: * * * * if(order) Split(&h, &h1, &h2); * * * * else{ * * * * * h = Reverse(h); * * * * * Split(&h, &h1, &h2); * * * * } * * * * printf("h1°G"); * * * * print_list(h1); * * * * printf("h2°G"); * * * * print_list(h2); * * * * break; * * * default: printf("±z™∫øÈ§J¶≥ª~°I\n"); * * * case 8: help(); * * } * } ! temp = (node*)malloc(sizeof(node)); ! temp->data = data; ! temp->next = p->next; ! p->next = temp; * return 0; } void print_list(node *h){ * node *temp; * temp = h; * while(temp != NULL){ * * printf("%d -> ", temp->data); * * temp = temp->next; * } * printf("NULL\n"); } node *Insert(int data, node *h){ * node *p, *t, *temp; * if(h==NULL){ * * temp = (node*)malloc(sizeof(node)); * * temp->data = data; * * temp->next = NULL; * * return temp; * } * p = h; ! (*h1_ptr)->next = (*h2_ptr)->next = NULL; ! *h1_ptr = h1; ! *h2_ptr = h2; ! *h = NULL; * t = h->next; * if(datadata){ * * temp = (node*)malloc(sizeof(node)); * * temp->data = data; * * temp->next = p; * * return temp; * } * if(t!=NULL) * * while(datadata || data>t->data){ * * * p = p->next; * * * t = t->next; * * * if(t==NULL) break; * * } * temp = (node*)malloc(sizeof(node)); * temp->data = data; * temp->next = p->next; * p->next = temp; ! node *h=NULL, *h1=NULL, *h2=NULL; ! help(); * return h; } node *Delete(int data, node *h){ * node *p, *t; * if(h==NULL) return h; * p = h; * t = h->next; * if(data == p->data){ * * p = p->next; * * free(h); * * return p; * } * while(data!=t->data){ * * p = p->next; * * t = t->next; * * if(t==NULL) return h; * } * p->next = t->next; * free(t); * return h; } node *Search(int data, node *h){ ! node *p=h; ! while(p!=NULL && data!=p->data)! p = p->next; ! return p; } int Count(node *h){ ! int count=0; ! while(h!=NULL){ ! ! count += 1; ! ! h = h->next; ! } ! return count; } node *Reverse(node *h){ * node *a, *b, *c; * if(h==NULL || h->next==NULL) return h; * a = h; * b = a->next; * c = b->next; * a->next = NULL; ! while(c!=NULL){ ! ! b->next = a; ! ! a = b; ! ! b = c; ! ! c = c->next; ! } * b->next = a; * order = !order; * return b; } node *Merge(node *h1, node *h2){ * node *h, *temp; * h = temp = h1->data < h2->data ? h1 : h2; * h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); * while(h1!=NULL && h2!=NULL){ * * temp = temp->next = h1->data < h2->data ? h1 : h2; * * h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); * } ! while(c!=NULL){ ! ! b->next = a; ! ! a = b; ! ! b = c; ! ! c = c->next; ! } * h2 == NULL ? (temp->next=h1) : (temp->next=h2); * return h; } void Split(node **h, node **h1_ptr, node **h2_ptr){ * node *h1=NULL, *h2=NULL; * while(*h!=NULL){ * * if((*h)->data%2){ * * * if(h1==NULL) h1 = *h1_ptr = *h; * * * else *h1_ptr = (*h1_ptr)->next = *h; * * }else{ * * * if(h2==NULL) h2 = *h2_ptr = *h; * * * else *h2_ptr = (*h2_ptr)->next = *h; * * } * * *h = (*h)->next; * } * (*h1_ptr)->next = (*h2_ptr)->next = NULL; * *h1_ptr = h1; * *h2_ptr = h2; * *h = NULL; } void print_list(node *h){ ! node *temp; ! temp = h; ! while(temp != NULL){ ! ! printf("%d -> ", temp->data); ! ! temp = temp->next; ! } ! printf("NULL\n"); } void help(){ * printf("0.µ≤ßÙ\n"); * printf("1.Insert\n"); * printf("2.Delete\n"); * printf("3.Search\n"); * printf("4.Count\n"); * printf("5.Reverse\n"); * printf("6.Merge\n"); * printf("7.Split\n"); * printf("8.help\n");

Slide 49

Slide 49 text

/*¶®•\§jæ«∏Í∞T§uµ{æ«®t98Ø≈§AØZ≤¶•…¨u æ«∏π°GF74942294*/ / ****************************************************************************** * FileName: hw7_s.c Programmer: CrBoy Purpose: ≥–≥y§@≠”singly linked list®√∞ı¶Ê¶U∫ÿ•\؇ Input: Output: the standard out Compilation: gcc hw7_s.c -o hw7_s Run: ./hw7_s Date: 2006/1/8 / ****************************************************************************** / #include struct node{ * int data; * struct node *next; }; typedef struct node node; void print_list(node*);/*print_list(h); ¶C¶L•Hh∂}¿Y™∫linked list*/ node *Insert(int, node*);/*Insert(data, h); ¶b•Hh∂}¿Y™∫linked list§§¥ °§Jdata®√¶^∂«∑s™∫h*/ node *Delete(int, node*);/*Delete(data, h); ¶b•Hh∂}¿Y™∫linked list§§ßR∞ £data®√¶^∂«∑s™∫h*/ node *Search(int, node*);/*Search(data, h); ¶b•Hh∂}¿Y™∫linked list§§¥Mß ‰data®√∂«¶^data©“¶b™∫¶Ï∏m*/ int Count(node*);/*Count(h); ≠p∫‚•Hh∂}¿Y™∫linked list§§™∫∏`¬I≠”º∆*/ node *Reverse(node*);/*Reverse(h); §œß«±∆¶C•Hh∂}¿Y™∫linked list®√∂«¶^∑s™∫h*/ node *Merge(node*, node*);/*Merge(h1, h2); ¶X®÷h1ªPh2≥o2≠”linked list®√¶^∂«¶X®÷´·™∫™∫head*/ void Split(node**, node**, node**);/*Split(&h, &h1, &h2); §¿≥Œh≥o≠”linked list¨∞©_∞∏º∆®√§¿ßO¶s®Ïh1ªPh2§§*/ void help(); int order=1; int main(void){ ! node *h1=NULL, *h2=NULL; ! while(*h!=NULL){ ! ! if((*h)->data%2){ ! ! ! if(h1==NULL) h1 = *h1_ptr = *h; ! ! ! else *h1_ptr = (*h1_ptr)->next = *h; ! ! }else{ ! ! ! if(h2==NULL) h2 = *h2_ptr = *h; ! ! ! else *h2_ptr = (*h2_ptr)->next = *h; ! ! } ! ! *h = (*h)->next; ! } ! (*h1_ptr)->next = (*h2_ptr)->next = NULL; ! *h1_ptr = h1; ! *h2_ptr = h2; ! *h = NULL; * int sel=8, data=0; * node *h=NULL, *h1=NULL, *h2=NULL; * help(); * while(sel){ * * printf("\n•ÿ´e™∫Linked list°G"); * * print_list(h); * * printf("Ω–øÔæ‹•\\؇°G"); * * if(scanf("%d", &sel)==0){ * * * sel=-1; * * * fflush(stdin); * * } * * switch(sel){ * * * case 0: break; ! ! ! case 1: ! ! ! ! printf("Ω–øÈ§J±˝¥°§J™∫愺∆≠»°G"); ! ! ! ! if(scanf("%d", &data)==0) continue; ! ! ! ! if(order) ! ! ! ! ! h = Insert(data, h); ! ! ! ! else{ ! ! ! ! ! h = Reverse(h); ! ! ! ! ! h = Insert(data, h); ! ! ! ! ! h = Reverse(h); ! ! ! ! } ! ! ! ! break; ! ! ! case 2: ! ! ! ! printf("Ω–øÈ§J±˝ßR∞£™∫愺∆≠»°G"); ! ! ! ! if(scanf("%d", &data)==0) continue; ! ! ! ! if(order) ! ! ! ! ! h = Delete(data, h); ! ! ! ! else{ ! ! ! ! ! h = Reverse(h); ! ! ! ! ! h = Delete(data, h); ! ! ! ! ! h = Reverse(h); ! ! ! ! } ! ! ! ! break; * * * case 3: * * * * printf("Ω–øÈ§J±˝∑j¥M™∫愺∆≠»°G"); * * * * if(scanf("%d", &data)==0) continue; * * * * h1 = Search(data, h); * * * * printf("•H%dß@¨∞∞_¬I™∫Linked list°G", data); * * * * print_list(h1); * * * * h1 = NULL; * * * * break; * * * case 4: * * * * printf("•ÿ´e™∫Linked list¶@¶≥%d≠”node °C\n", Count(h)); * * * * break; * * * case 5: * * * * h = Reverse(h); * * * * break; * * * case 6: * * * * printf("h1°G"); * * * * print_list(h1); * * * * printf("h2°G"); * * * * print_list(h2); * * * * h = Merge(h1, h2); * * * * h1 = h2 = NULL; * * * * break; * * * case 7: * * * * if(order) Split(&h, &h1, &h2); * * * * else{ * * * * * h = Reverse(h); * * * * * Split(&h, &h1, &h2); * * * * } * * * * printf("h1°G"); * * * * print_list(h1); * * * * printf("h2°G"); * * * * print_list(h2); * * * * break; * * * default: printf("±z™∫øÈ§J¶≥ª~°I\n"); * * * case 8: help(); * * } * } ! temp = (node*)malloc(sizeof(node)); ! temp->data = data; ! temp->next = p->next; ! p->next = temp; * return 0; } void print_list(node *h){ * node *temp; * temp = h; * while(temp != NULL){ * * printf("%d -> ", temp->data); * * temp = temp->next; * } * printf("NULL\n"); } node *Insert(int data, node *h){ * node *p, *t, *temp; * if(h==NULL){ * * temp = (node*)malloc(sizeof(node)); * * temp->data = data; * * temp->next = NULL; * * return temp; * } * p = h; ! (*h1_ptr)->next = (*h2_ptr)->next = NULL; ! *h1_ptr = h1; ! *h2_ptr = h2; ! *h = NULL; * t = h->next; * if(datadata){ * * temp = (node*)malloc(sizeof(node)); * * temp->data = data; * * temp->next = p; * * return temp; * } * if(t!=NULL) * * while(datadata || data>t->data){ * * * p = p->next; * * * t = t->next; * * * if(t==NULL) break; * * } * temp = (node*)malloc(sizeof(node)); * temp->data = data; * temp->next = p->next; * p->next = temp; ! node *h=NULL, *h1=NULL, *h2=NULL; ! help(); * return h; } node *Delete(int data, node *h){ * node *p, *t; * if(h==NULL) return h; * p = h; * t = h->next; * if(data == p->data){ * * p = p->next; * * free(h); * * return p; * } * while(data!=t->data){ * * p = p->next; * * t = t->next; * * if(t==NULL) return h; * } * p->next = t->next; * free(t); * return h; } node *Search(int data, node *h){ ! node *p=h; ! while(p!=NULL && data!=p->data)! p = p->next; ! return p; } int Count(node *h){ ! int count=0; ! while(h!=NULL){ ! ! count += 1; ! ! h = h->next; ! } ! return count; } node *Reverse(node *h){ * node *a, *b, *c; * if(h==NULL || h->next==NULL) return h; * a = h; * b = a->next; * c = b->next; * a->next = NULL; ! while(c!=NULL){ ! ! b->next = a; ! ! a = b; ! ! b = c; ! ! c = c->next; ! } * b->next = a; * order = !order; * return b; } node *Merge(node *h1, node *h2){ * node *h, *temp; * h = temp = h1->data < h2->data ? h1 : h2; * h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); * while(h1!=NULL && h2!=NULL){ * * temp = temp->next = h1->data < h2->data ? h1 : h2; * * h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); * } ! while(c!=NULL){ ! ! b->next = a; ! ! a = b; ! ! b = c; ! ! c = c->next; ! } * h2 == NULL ? (temp->next=h1) : (temp->next=h2); * return h; } void Split(node **h, node **h1_ptr, node **h2_ptr){ * node *h1=NULL, *h2=NULL; * while(*h!=NULL){ * * if((*h)->data%2){ * * * if(h1==NULL) h1 = *h1_ptr = *h; * * * else *h1_ptr = (*h1_ptr)->next = *h; * * }else{ * * * if(h2==NULL) h2 = *h2_ptr = *h; * * * else *h2_ptr = (*h2_ptr)->next = *h; * * } * * *h = (*h)->next; * } * (*h1_ptr)->next = (*h2_ptr)->next = NULL; * *h1_ptr = h1; * *h2_ptr = h2; * *h = NULL; } void print_list(node *h){ ! node *temp; ! temp = h; ! while(temp != NULL){ ! ! printf("%d -> ", temp->data); ! ! temp = temp->next; ! } ! printf("NULL\n"); } void help(){ * printf("0.µ≤ßÙ\n"); * printf("1.Insert\n"); * printf("2.Delete\n"); * printf("3.Search\n"); * printf("4.Count\n"); * printf("5.Reverse\n"); * printf("6.Merge\n"); * printf("7.Split\n"); * printf("8.help\n"); ҷΫԸl

Slide 50

Slide 50 text

/*¶®•\§jæ«∏Í∞T§uµ{æ«®t98Ø≈§AØZ≤¶•…¨u æ«∏π°GF74942294*/ / ****************************************************************************** * FileName: hw7_s.c Programmer: CrBoy Purpose: ≥–≥y§@≠”singly linked list®√∞ı¶Ê¶U∫ÿ•\؇ Input: Output: the standard out Compilation: gcc hw7_s.c -o hw7_s Run: ./hw7_s Date: 2006/1/8 / ****************************************************************************** / #include struct node{ * int data; * struct node *next; }; typedef struct node node; void print_list(node*);/*print_list(h); ¶C¶L•Hh∂}¿Y™∫linked list*/ node *Insert(int, node*);/*Insert(data, h); ¶b•Hh∂}¿Y™∫linked list§§¥ °§Jdata®√¶^∂«∑s™∫h*/ node *Delete(int, node*);/*Delete(data, h); ¶b•Hh∂}¿Y™∫linked list§§ßR∞ £data®√¶^∂«∑s™∫h*/ node *Search(int, node*);/*Search(data, h); ¶b•Hh∂}¿Y™∫linked list§§¥Mß ‰data®√∂«¶^data©“¶b™∫¶Ï∏m*/ int Count(node*);/*Count(h); ≠p∫‚•Hh∂}¿Y™∫linked list§§™∫∏`¬I≠”º∆*/ node *Reverse(node*);/*Reverse(h); §œß«±∆¶C•Hh∂}¿Y™∫linked list®√∂«¶^∑s™∫h*/ node *Merge(node*, node*);/*Merge(h1, h2); ¶X®÷h1ªPh2≥o2≠”linked list®√¶^∂«¶X®÷´·™∫™∫head*/ void Split(node**, node**, node**);/*Split(&h, &h1, &h2); §¿≥Œh≥o≠”linked list¨∞©_∞∏º∆®√§¿ßO¶s®Ïh1ªPh2§§*/ void help(); int order=1; int main(void){ ! node *h1=NULL, *h2=NULL; ! while(*h!=NULL){ ! ! if((*h)->data%2){ ! ! ! if(h1==NULL) h1 = *h1_ptr = *h; ! ! ! else *h1_ptr = (*h1_ptr)->next = *h; ! ! }else{ ! ! ! if(h2==NULL) h2 = *h2_ptr = *h; ! ! ! else *h2_ptr = (*h2_ptr)->next = *h; ! ! } ! ! *h = (*h)->next; ! } ! (*h1_ptr)->next = (*h2_ptr)->next = NULL; ! *h1_ptr = h1; ! *h2_ptr = h2; ! *h = NULL; * int sel=8, data=0; * node *h=NULL, *h1=NULL, *h2=NULL; * help(); * while(sel){ * * printf("\n•ÿ´e™∫Linked list°G"); * * print_list(h); * * printf("Ω–øÔæ‹•\\؇°G"); * * if(scanf("%d", &sel)==0){ * * * sel=-1; * * * fflush(stdin); * * } * * switch(sel){ * * * case 0: break; ! ! ! case 1: ! ! ! ! printf("Ω–øÈ§J±˝¥°§J™∫愺∆≠»°G"); ! ! ! ! if(scanf("%d", &data)==0) continue; ! ! ! ! if(order) ! ! ! ! ! h = Insert(data, h); ! ! ! ! else{ ! ! ! ! ! h = Reverse(h); ! ! ! ! ! h = Insert(data, h); ! ! ! ! ! h = Reverse(h); ! ! ! ! } ! ! ! ! break; ! ! ! case 2: ! ! ! ! printf("Ω–øÈ§J±˝ßR∞£™∫愺∆≠»°G"); ! ! ! ! if(scanf("%d", &data)==0) continue; ! ! ! ! if(order) ! ! ! ! ! h = Delete(data, h); ! ! ! ! else{ ! ! ! ! ! h = Reverse(h); ! ! ! ! ! h = Delete(data, h); ! ! ! ! ! h = Reverse(h); ! ! ! ! } ! ! ! ! break; * * * case 3: * * * * printf("Ω–øÈ§J±˝∑j¥M™∫愺∆≠»°G"); * * * * if(scanf("%d", &data)==0) continue; * * * * h1 = Search(data, h); * * * * printf("•H%dß@¨∞∞_¬I™∫Linked list°G", data); * * * * print_list(h1); * * * * h1 = NULL; * * * * break; * * * case 4: * * * * printf("•ÿ´e™∫Linked list¶@¶≥%d≠”node °C\n", Count(h)); * * * * break; * * * case 5: * * * * h = Reverse(h); * * * * break; * * * case 6: * * * * printf("h1°G"); * * * * print_list(h1); * * * * printf("h2°G"); * * * * print_list(h2); * * * * h = Merge(h1, h2); * * * * h1 = h2 = NULL; * * * * break; * * * case 7: * * * * if(order) Split(&h, &h1, &h2); * * * * else{ * * * * * h = Reverse(h); * * * * * Split(&h, &h1, &h2); * * * * } * * * * printf("h1°G"); * * * * print_list(h1); * * * * printf("h2°G"); * * * * print_list(h2); * * * * break; * * * default: printf("±z™∫øÈ§J¶≥ª~°I\n"); * * * case 8: help(); * * } * } ! temp = (node*)malloc(sizeof(node)); ! temp->data = data; ! temp->next = p->next; ! p->next = temp; * return 0; } void print_list(node *h){ * node *temp; * temp = h; * while(temp != NULL){ * * printf("%d -> ", temp->data); * * temp = temp->next; * } * printf("NULL\n"); } node *Insert(int data, node *h){ * node *p, *t, *temp; * if(h==NULL){ * * temp = (node*)malloc(sizeof(node)); * * temp->data = data; * * temp->next = NULL; * * return temp; * } * p = h; ! (*h1_ptr)->next = (*h2_ptr)->next = NULL; ! *h1_ptr = h1; ! *h2_ptr = h2; ! *h = NULL; * t = h->next; * if(datadata){ * * temp = (node*)malloc(sizeof(node)); * * temp->data = data; * * temp->next = p; * * return temp; * } * if(t!=NULL) * * while(datadata || data>t->data){ * * * p = p->next; * * * t = t->next; * * * if(t==NULL) break; * * } * temp = (node*)malloc(sizeof(node)); * temp->data = data; * temp->next = p->next; * p->next = temp; ! node *h=NULL, *h1=NULL, *h2=NULL; ! help(); * return h; } node *Delete(int data, node *h){ * node *p, *t; * if(h==NULL) return h; * p = h; * t = h->next; * if(data == p->data){ * * p = p->next; * * free(h); * * return p; * } * while(data!=t->data){ * * p = p->next; * * t = t->next; * * if(t==NULL) return h; * } * p->next = t->next; * free(t); * return h; } node *Search(int data, node *h){ ! node *p=h; ! while(p!=NULL && data!=p->data)! p = p->next; ! return p; } int Count(node *h){ ! int count=0; ! while(h!=NULL){ ! ! count += 1; ! ! h = h->next; ! } ! return count; } node *Reverse(node *h){ * node *a, *b, *c; * if(h==NULL || h->next==NULL) return h; * a = h; * b = a->next; * c = b->next; * a->next = NULL; ! while(c!=NULL){ ! ! b->next = a; ! ! a = b; ! ! b = c; ! ! c = c->next; ! } * b->next = a; * order = !order; * return b; } node *Merge(node *h1, node *h2){ * node *h, *temp; * h = temp = h1->data < h2->data ? h1 : h2; * h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); * while(h1!=NULL && h2!=NULL){ * * temp = temp->next = h1->data < h2->data ? h1 : h2; * * h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); * } ! while(c!=NULL){ ! ! b->next = a; ! ! a = b; ! ! b = c; ! ! c = c->next; ! } * h2 == NULL ? (temp->next=h1) : (temp->next=h2); * return h; } void Split(node **h, node **h1_ptr, node **h2_ptr){ * node *h1=NULL, *h2=NULL; * while(*h!=NULL){ * * if((*h)->data%2){ * * * if(h1==NULL) h1 = *h1_ptr = *h; * * * else *h1_ptr = (*h1_ptr)->next = *h; * * }else{ * * * if(h2==NULL) h2 = *h2_ptr = *h; * * * else *h2_ptr = (*h2_ptr)->next = *h; * * } * * *h = (*h)->next; * } * (*h1_ptr)->next = (*h2_ptr)->next = NULL; * *h1_ptr = h1; * *h2_ptr = h2; * *h = NULL; } void help(){ * printf("0.µ≤ßÙ\n"); * printf("1.Insert\n"); * printf("2.Delete\n"); * printf("3.Search\n"); * printf("4.Count\n"); * printf("5.Reverse\n"); * printf("6.Merge\n"); * printf("7.Split\n"); * printf("8.help\n"); } ҷΫԸl

Slide 51

Slide 51 text

/*¶®•\§jæ«∏Í∞T§uµ{æ«®t98Ø≈§AØZ≤¶•…¨u æ«∏π°GF74942294*/ / ****************************************************************************** * FileName: hw7_s.c Programmer: CrBoy Purpose: ≥–≥y§@≠”singly linked list®√∞ı¶Ê¶U∫ÿ•\؇ Input: Output: the standard out Compilation: gcc hw7_s.c -o hw7_s Run: ./hw7_s Date: 2006/1/8 / ****************************************************************************** / #include struct node{ * int data; * struct node *next; }; typedef struct node node; void print_list(node*);/*print_list(h); ¶C¶L•Hh∂}¿Y™∫linked list*/ node *Insert(int, node*);/*Insert(data, h); ¶b•Hh∂}¿Y™∫linked list§§¥ °§Jdata®√¶^∂«∑s™∫h*/ node *Delete(int, node*);/*Delete(data, h); ¶b•Hh∂}¿Y™∫linked list§§ßR∞ £data®√¶^∂«∑s™∫h*/ node *Search(int, node*);/*Search(data, h); ¶b•Hh∂}¿Y™∫linked list§§¥Mß ‰data®√∂«¶^data©“¶b™∫¶Ï∏m*/ int Count(node*);/*Count(h); ≠p∫‚•Hh∂}¿Y™∫linked list§§™∫∏`¬I≠”º∆*/ node *Reverse(node*);/*Reverse(h); §œß«±∆¶C•Hh∂}¿Y™∫linked list®√∂«¶^∑s™∫h*/ node *Merge(node*, node*);/*Merge(h1, h2); ¶X®÷h1ªPh2≥o2≠”linked list®√¶^∂«¶X®÷´·™∫™∫head*/ void Split(node**, node**, node**);/*Split(&h, &h1, &h2); §¿≥Œh≥o≠”linked list¨∞©_∞∏º∆®√§¿ßO¶s®Ïh1ªPh2§§*/ void help(); int order=1; int main(void){ ! node *h1=NULL, *h2=NULL; ! while(*h!=NULL){ ! ! if((*h)->data%2){ ! ! ! if(h1==NULL) h1 = *h1_ptr = *h; ! ! ! else *h1_ptr = (*h1_ptr)->next = *h; ! ! }else{ ! ! ! if(h2==NULL) h2 = *h2_ptr = *h; ! ! ! else *h2_ptr = (*h2_ptr)->next = *h; ! ! } ! ! *h = (*h)->next; ! } ! (*h1_ptr)->next = (*h2_ptr)->next = NULL; ! *h1_ptr = h1; ! *h2_ptr = h2; ! *h = NULL; * int sel=8, data=0; * node *h=NULL, *h1=NULL, *h2=NULL; * help(); * while(sel){ * * printf("\n•ÿ´e™∫Linked list°G"); * * print_list(h); * * printf("Ω–øÔæ‹•\\؇°G"); * * if(scanf("%d", &sel)==0){ * * * sel=-1; * * * fflush(stdin); * * } * * switch(sel){ * * * case 0: break; * * * case 1: * * * * printf("Ω–øÈ§J±˝¥°§J™∫愺∆≠»°G"); * * * * if(scanf("%d", &data)==0) continue; * * * * if(order) * * * * * h = Insert(data, h); * * * * else{ * * * * * h = Reverse(h); * * * * * h = Insert(data, h); * * * * * h = Reverse(h); * * * * } * * * * break; * * * case 2: * * * * printf("Ω–øÈ§J±˝ßR∞£™∫愺∆≠»°G"); * * * * if(scanf("%d", &data)==0) continue; * * * * if(order) * * * * * h = Delete(data, h); * * * * else{ * * * * * h = Reverse(h); * * * * * h = Delete(data, h); * * * * * h = Reverse(h); * * * * } * * * * break; * * * case 3: * * * * printf("Ω–øÈ§J±˝∑j¥M™∫愺∆≠»°G"); * * * * if(scanf("%d", &data)==0) continue; * * * * h1 = Search(data, h); * * * * printf("•H%dß@¨∞∞_¬I™∫Linked list°G", data); * * * * print_list(h1); * * * * h1 = NULL; * * * * break; * * * case 4: * * * * printf("•ÿ´e™∫Linked list¶@¶≥%d≠”node °C\n", Count(h)); * * * * break; * * * case 5: * * * * h = Reverse(h); * * * * break; * * * case 6: * * * * printf("h1°G"); * * * * print_list(h1); * * * * printf("h2°G"); * * * * print_list(h2); * * * * h = Merge(h1, h2); * * * * h1 = h2 = NULL; * * * * break; * * * case 7: * * * * if(order) Split(&h, &h1, &h2); * * * * else{ * * * * * h = Reverse(h); * * * * * Split(&h, &h1, &h2); * * * * } * * * * printf("h1°G"); * * * * print_list(h1); * * * * printf("h2°G"); * * * * print_list(h2); * * * * break; * * * default: printf("±z™∫øÈ§J¶≥ª~°I\n"); * * * case 8: help(); * * } * } ! temp = (node*)malloc(sizeof(node)); ! temp->data = data; ! temp->next = p->next; ! p->next = temp; * return 0; } void print_list(node *h){ * node *temp; * temp = h; * while(temp != NULL){ * * printf("%d -> ", temp->data); * * temp = temp->next; * } * printf("NULL\n"); } node *Insert(int data, node *h){ * node *p, *t, *temp; * if(h==NULL){ * * temp = (node*)malloc(sizeof(node)); * * temp->data = data; * * temp->next = NULL; * * return temp; * } * p = h; * t = h->next; * if(datadata){ * * temp = (node*)malloc(sizeof(node)); * * temp->data = data; * * temp->next = p; * * return temp; * } * if(t!=NULL) * * while(datadata || data>t->data){ * * * p = p->next; * * * t = t->next; * * * if(t==NULL) break; * * } * temp = (node*)malloc(sizeof(node)); * temp->data = data; * temp->next = p->next; * p->next = temp; * return h; } node *Delete(int data, node *h){ * node *p, *t; * if(h==NULL) return h; * p = h; * t = h->next; * if(data == p->data){ * * p = p->next; * * free(h); * * return p; * } * while(data!=t->data){ * * p = p->next; * * t = t->next; * * if(t==NULL) return h; * } * p->next = t->next; * free(t); * return h; } node *Search(int data, node *h){ * node *p=h; * while(p!=NULL && data!=p->data)* p = p->next; * return p; } int Count(node *h){ * int count=0; * while(h!=NULL){ * * count += 1; * * h = h->next; * } * return count; } node *Reverse(node *h){ * node *a, *b, *c; * if(h==NULL || h->next==NULL) return h; * a = h; * b = a->next; * c = b->next; * a->next = NULL; ! while(c!=NULL){ ! ! b->next = a; ! ! a = b; ! ! b = c; ! ! c = c->next; ! } * b->next = a; * order = !order; * return b; } node *Merge(node *h1, node *h2){ * node *h, *temp; * h = temp = h1->data < h2->data ? h1 : h2; * h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); * while(h1!=NULL && h2!=NULL){ * * temp = temp->next = h1->data < h2->data ? h1 : h2; * * h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); * } ! while(c!=NULL){ ! ! b->next = a; ! ! a = b; ! ! b = c; ! ! c = c->next; ! } * h2 == NULL ? (temp->next=h1) : (temp->next=h2); * return h; } void Split(node **h, node **h1_ptr, node **h2_ptr){ * node *h1=NULL, *h2=NULL; * while(*h!=NULL){ * * if((*h)->data%2){ * * * if(h1==NULL) h1 = *h1_ptr = *h; * * * else *h1_ptr = (*h1_ptr)->next = *h; * * }else{ * * * if(h2==NULL) h2 = *h2_ptr = *h; * * * else *h2_ptr = (*h2_ptr)->next = *h; * * } * * *h = (*h)->next; * } * (*h1_ptr)->next = (*h2_ptr)->next = NULL; * *h1_ptr = h1; * *h2_ptr = h2; * *h = NULL; } void help(){ * printf("0.µ≤ßÙ\n"); * printf("1.Insert\n"); * printf("2.Delete\n"); * printf("3.Search\n"); * printf("4.Count\n"); * printf("5.Reverse\n"); * printf("6.Merge\n"); * printf("7.Split\n"); * printf("8.help\n"); } ҷΫԸҷΫԸҷΫԸl

Slide 52

Slide 52 text

/*¶®•\§jæ«∏Í∞T§uµ{æ«®t98Ø≈§AØZ≤¶•…¨u æ«∏π°GF74942294*/ / ****************************************************************************** * FileName: hw7_s.c Programmer: CrBoy Purpose: ≥–≥y§@≠”singly linked list®√∞ı¶Ê¶U∫ÿ•\؇ Input: Output: the standard out Compilation: gcc hw7_s.c -o hw7_s Run: ./hw7_s Date: 2006/1/8 / ****************************************************************************** / #include struct node{ * int data; * struct node *next; }; typedef struct node node; void print_list(node*);/*print_list(h); ¶C¶L•Hh∂}¿Y™∫linked list*/ node *Insert(int, node*);/*Insert(data, h); ¶b•Hh∂}¿Y™∫linked list§§¥ °§Jdata®√¶^∂«∑s™∫h*/ node *Delete(int, node*);/*Delete(data, h); ¶b•Hh∂}¿Y™∫linked list§§ßR∞ £data®√¶^∂«∑s™∫h*/ node *Search(int, node*);/*Search(data, h); ¶b•Hh∂}¿Y™∫linked list§§¥Mß ‰data®√∂«¶^data©“¶b™∫¶Ï∏m*/ int Count(node*);/*Count(h); ≠p∫‚•Hh∂}¿Y™∫linked list§§™∫∏`¬I≠”º∆*/ node *Reverse(node*);/*Reverse(h); §œß«±∆¶C•Hh∂}¿Y™∫linked list®√∂«¶^∑s™∫h*/ node *Merge(node*, node*);/*Merge(h1, h2); ¶X®÷h1ªPh2≥o2≠”linked list®√¶^∂«¶X®÷´·™∫™∫head*/ void Split(node**, node**, node**);/*Split(&h, &h1, &h2); §¿≥Œh≥o≠”linked list¨∞©_∞∏º∆®√§¿ßO¶s®Ïh1ªPh2§§*/ void help(); int order=1; int main(void){ ! node *h1=NULL, *h2=NULL; ! while(*h!=NULL){ ! ! if((*h)->data%2){ ! ! ! if(h1==NULL) h1 = *h1_ptr = *h; ! ! ! else *h1_ptr = (*h1_ptr)->next = *h; ! ! }else{ ! ! ! if(h2==NULL) h2 = *h2_ptr = *h; ! ! ! else *h2_ptr = (*h2_ptr)->next = *h; ! ! } ! ! *h = (*h)->next; ! } ! (*h1_ptr)->next = (*h2_ptr)->next = NULL; ! *h1_ptr = h1; ! *h2_ptr = h2; ! *h = NULL; * int sel=8, data=0; * node *h=NULL, *h1=NULL, *h2=NULL; * help(); * while(sel){ * * printf("\n•ÿ´e™∫Linked list°G"); * * print_list(h); * * printf("Ω–øÔæ‹•\\؇°G"); * * if(scanf("%d", &sel)==0){ * * * sel=-1; * * * fflush(stdin); * * } * * switch(sel){ * * * case 0: break; * * * case 1: * * * * printf("Ω–øÈ§J±˝¥°§J™∫愺∆≠»°G"); * * * * if(scanf("%d", &data)==0) continue; * * * * if(order) * * * * * h = Insert(data, h); * * * * else{ * * * * * h = Reverse(h); * * * * * h = Insert(data, h); * * * * * h = Reverse(h); * * * * } * * * * break; * * * case 2: * * * * printf("Ω–øÈ§J±˝ßR∞£™∫愺∆≠»°G"); * * * * if(scanf("%d", &data)==0) continue; * * * * if(order) * * * * * h = Delete(data, h); * * * * else{ * * * * * h = Reverse(h); * * * * * h = Delete(data, h); * * * * * h = Reverse(h); * * * * } * * * * break; * * * case 3: * * * * printf("Ω–øÈ§J±˝∑j¥M™∫愺∆≠»°G"); * * * * if(scanf("%d", &data)==0) continue; * * * * h1 = Search(data, h); * * * * printf("•H%dß@¨∞∞_¬I™∫Linked list°G", data); * * * * print_list(h1); * * * * h1 = NULL; * * * * break; * * * case 4: * * * * printf("•ÿ´e™∫Linked list¶@¶≥%d≠”node °C\n", Count(h)); * * * * break; * * * case 5: * * * * h = Reverse(h); * * * * break; * * * case 6: * * * * printf("h1°G"); * * * * print_list(h1); * * * * printf("h2°G"); * * * * print_list(h2); * * * * h = Merge(h1, h2); * * * * h1 = h2 = NULL; * * * * break; * * * case 7: * * * * if(order) Split(&h, &h1, &h2); * * * * else{ * * * * * h = Reverse(h); * * * * * Split(&h, &h1, &h2); * * * * } * * * * printf("h1°G"); * * * * print_list(h1); * * * * printf("h2°G"); * * * * print_list(h2); * * * * break; * * * default: printf("±z™∫øÈ§J¶≥ª~°I\n"); * * * case 8: help(); * * } * } ! temp = (node*)malloc(sizeof(node)); ! temp->data = data; ! temp->next = p->next; ! p->next = temp; * return 0; } void print_list(node *h){ * node *temp; * temp = h; * while(temp != NULL){ * * printf("%d -> ", temp->data); * * temp = temp->next; * } * printf("NULL\n"); } node *Insert(int data, node *h){ * node *p, *t, *temp; * if(h==NULL){ * * temp = (node*)malloc(sizeof(node)); * * temp->data = data; * * temp->next = NULL; * * return temp; * } * p = h; * t = h->next; * if(datadata){ * * temp = (node*)malloc(sizeof(node)); * * temp->data = data; * * temp->next = p; * * return temp; * } * if(t!=NULL) * * while(datadata || data>t->data){ * * * p = p->next; * * * t = t->next; * * * if(t==NULL) break; * * } * temp = (node*)malloc(sizeof(node)); * temp->data = data; * temp->next = p->next; * p->next = temp; * return h; } node *Delete(int data, node *h){ * node *p, *t; * if(h==NULL) return h; * p = h; * t = h->next; * if(data == p->data){ * * p = p->next; * * free(h); * * return p; * } * while(data!=t->data){ * * p = p->next; * * t = t->next; * * if(t==NULL) return h; * } * p->next = t->next; * free(t); * return h; } node *Search(int data, node *h){ * node *p=h; * while(p!=NULL && data!=p->data)* p = p->next; * return p; } int Count(node *h){ * int count=0; * while(h!=NULL){ * * count += 1; * * h = h->next; * } * return count; } node *Reverse(node *h){ * node *a, *b, *c; * if(h==NULL || h->next==NULL) return h; * a = h; * b = a->next; * c = b->next; * a->next = NULL; * while(c!=NULL){ * * b->next = a; * * a = b; * * b = c; * * c = c->next; * } * b->next = a; * order = !order; * return b; } node *Merge(node *h1, node *h2){ * node *h, *temp; * h = temp = h1->data < h2->data ? h1 : h2; * h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); * while(h1!=NULL && h2!=NULL){ * * temp = temp->next = h1->data < h2->data ? h1 : h2; * * h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); * } * h2 == NULL ? (temp->next=h1) : (temp->next=h2); * return h; } void Split(node **h, node **h1_ptr, node **h2_ptr){ * node *h1=NULL, *h2=NULL; * while(*h!=NULL){ * * if((*h)->data%2){ * * * if(h1==NULL) h1 = *h1_ptr = *h; * * * else *h1_ptr = (*h1_ptr)->next = *h; * * }else{ * * * if(h2==NULL) h2 = *h2_ptr = *h; * * * else *h2_ptr = (*h2_ptr)->next = *h; * * } * * *h = (*h)->next; * } * (*h1_ptr)->next = (*h2_ptr)->next = NULL; * *h1_ptr = h1; * *h2_ptr = h2; * *h = NULL; } void help(){ * printf("0.µ≤ßÙ\n"); * printf("1.Insert\n"); * printf("2.Delete\n"); * printf("3.Search\n"); * printf("4.Count\n"); * printf("5.Reverse\n"); * printf("6.Merge\n"); * printf("7.Split\n"); * printf("8.help\n"); } ୕୕ҷΫԸl

Slide 53

Slide 53 text

/*¶®•\§jæ«∏Í∞T§uµ{æ«®t98Ø≈§AØZ≤¶•…¨u æ«∏π°GF74942294*/ / ****************************************************************************** * FileName: hw7_s.c Programmer: CrBoy Purpose: ≥–≥y§@≠”singly linked list®√∞ı¶Ê¶U∫ÿ•\؇ Input: Output: the standard out Compilation: gcc hw7_s.c -o hw7_s Run: ./hw7_s Date: 2006/1/8 / ****************************************************************************** / #include struct node{ * int data; * struct node *next; }; typedef struct node node; void print_list(node*);/*print_list(h); ¶C¶L•Hh∂}¿Y™∫linked list*/ node *Insert(int, node*);/*Insert(data, h); ¶b•Hh∂}¿Y™∫linked list§§¥ °§Jdata®√¶^∂«∑s™∫h*/ node *Delete(int, node*);/*Delete(data, h); ¶b•Hh∂}¿Y™∫linked list§§ßR∞ £data®√¶^∂«∑s™∫h*/ node *Search(int, node*);/*Search(data, h); ¶b•Hh∂}¿Y™∫linked list§§¥Mß ‰data®√∂«¶^data©“¶b™∫¶Ï∏m*/ int Count(node*);/*Count(h); ≠p∫‚•Hh∂}¿Y™∫linked list§§™∫∏`¬I≠”º∆*/ node *Reverse(node*);/*Reverse(h); §œß«±∆¶C•Hh∂}¿Y™∫linked list®√∂«¶^∑s™∫h*/ node *Merge(node*, node*);/*Merge(h1, h2); ¶X®÷h1ªPh2≥o2≠”linked list®√¶^∂«¶X®÷´·™∫™∫head*/ void Split(node**, node**, node**);/*Split(&h, &h1, &h2); §¿≥Œh≥o≠”linked list¨∞©_∞∏º∆®√§¿ßO¶s®Ïh1ªPh2§§*/ void help(); int order=1; int main(void){ * int sel=8, data=0; * node *h=NULL, *h1=NULL, *h2=NULL; * help(); * while(sel){ * * printf("\n•ÿ´e™∫Linked list°G"); * * print_list(h); * * printf("Ω–øÔæ‹•\\؇°G"); * * if(scanf("%d", &sel)==0){ * * * sel=-1; * * * fflush(stdin); * * } * * switch(sel){ * * * case 0: break; * * * case 1: * * * * printf("Ω–øÈ§J±˝¥°§J™∫愺∆≠»°G"); * * * * if(scanf("%d", &data)==0) continue; * * * * if(order) * * * * * h = Insert(data, h); * * * * else{ * * * * * h = Reverse(h); * * * * * h = Insert(data, h); * * * * * h = Reverse(h); * * * * } * * * * break; * * * case 2: * * * * printf("Ω–øÈ§J±˝ßR∞£™∫愺∆≠»°G"); * * * * if(scanf("%d", &data)==0) continue; * * * * if(order) * * * * * h = Delete(data, h); * * * * else{ * * * * * h = Reverse(h); * * * * * h = Delete(data, h); * * * * * h = Reverse(h); * * * * } * * * * break; * * * case 3: * * * * printf("Ω–øÈ§J±˝∑j¥M™∫愺∆≠»°G"); * * * * if(scanf("%d", &data)==0) continue; * * * * h1 = Search(data, h); * * * * printf("•H%dß@¨∞∞_¬I™∫Linked list°G", data); * * * * print_list(h1); * * * * h1 = NULL; * * * * break; * * * case 4: * * * * printf("•ÿ´e™∫Linked list¶@¶≥%d≠”node °C\n", Count(h)); * * * * break; * * * case 5: * * * * h = Reverse(h); * * * * break; * * * case 6: * * * * printf("h1°G"); * * * * print_list(h1); * * * * printf("h2°G"); * * * * print_list(h2); * * * * h = Merge(h1, h2); * * * * h1 = h2 = NULL; * * * * break; * * * case 7: * * * * if(order) Split(&h, &h1, &h2); * * * * else{ * * * * * h = Reverse(h); * * * * * Split(&h, &h1, &h2); * * * * } * * * * printf("h1°G"); * * * * print_list(h1); * * * * printf("h2°G"); * * * * print_list(h2); * * * * break; * * * default: printf("±z™∫øÈ§J¶≥ª~°I\n"); * * * case 8: help(); * * } * } * return 0; } void print_list(node *h){ * node *temp; * temp = h; * while(temp != NULL){ * * printf("%d -> ", temp->data); * * temp = temp->next; * } * printf("NULL\n"); } node *Insert(int data, node *h){ * node *p, *t, *temp; * if(h==NULL){ * * temp = (node*)malloc(sizeof(node)); * * temp->data = data; * * temp->next = NULL; * * return temp; * } * p = h; * t = h->next; * if(datadata){ * * temp = (node*)malloc(sizeof(node)); * * temp->data = data; * * temp->next = p; * * return temp; * } * if(t!=NULL) * * while(datadata || data>t->data){ * * * p = p->next; * * * t = t->next; * * * if(t==NULL) break; * * } * temp = (node*)malloc(sizeof(node)); * temp->data = data; * temp->next = p->next; * p->next = temp; * return h; } node *Delete(int data, node *h){ * node *p, *t; * if(h==NULL) return h; * p = h; * t = h->next; * if(data == p->data){ * * p = p->next; * * free(h); * * return p; * } * while(data!=t->data){ * * p = p->next; * * t = t->next; * * if(t==NULL) return h; * } * p->next = t->next; * free(t); * return h; } node *Search(int data, node *h){ * node *p=h; * while(p!=NULL && data!=p->data)* p = p->next; * return p; } int Count(node *h){ * int count=0; * while(h!=NULL){ * * count += 1; * * h = h->next; * } * return count; } node *Reverse(node *h){ * node *a, *b, *c; * if(h==NULL || h->next==NULL) return h; * a = h; * b = a->next; * c = b->next; * a->next = NULL; * while(c!=NULL){ * * b->next = a; * * a = b; * * b = c; * * c = c->next; * } * b->next = a; * order = !order; * return b; } node *Merge(node *h1, node *h2){ * node *h, *temp; * h = temp = h1->data < h2->data ? h1 : h2; * h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); * while(h1!=NULL && h2!=NULL){ * * temp = temp->next = h1->data < h2->data ? h1 : h2; * * h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); * } * h2 == NULL ? (temp->next=h1) : (temp->next=h2); * return h; } void Split(node **h, node **h1_ptr, node **h2_ptr){ * node *h1=NULL, *h2=NULL; * while(*h!=NULL){ * * if((*h)->data%2){ * * * if(h1==NULL) h1 = *h1_ptr = *h; * * * else *h1_ptr = (*h1_ptr)->next = *h; * * }else{ * * * if(h2==NULL) h2 = *h2_ptr = *h; * * * else *h2_ptr = (*h2_ptr)->next = *h; * * } * * *h = (*h)->next; * } * (*h1_ptr)->next = (*h2_ptr)->next = NULL; * *h1_ptr = h1; * *h2_ptr = h2; * *h = NULL; } void help(){ * printf("0.µ≤ßÙ\n"); * printf("1.Insert\n"); * printf("2.Delete\n"); * printf("3.Search\n"); * printf("4.Count\n"); * printf("5.Reverse\n"); * printf("6.Merge\n"); * printf("7.Split\n"); * printf("8.help\n"); } ॆٙҷΫԸə෗k ϞӚϞࡳ༁ҷ፹k

Slide 54

Slide 54 text

No content

Slide 55

Slide 55 text

No content

Slide 56

Slide 56 text

No content

Slide 57

Slide 57 text

No content

Slide 58

Slide 58 text

No content

Slide 59

Slide 59 text

No content

Slide 60

Slide 60 text

No content

Slide 61

Slide 61 text

No content

Slide 62

Slide 62 text

No content

Slide 63

Slide 63 text

No content

Slide 64

Slide 64 text

No content

Slide 65

Slide 65 text

No content

Slide 66

Slide 66 text

ᒔϞ͜&9$&-া፽ҷəʡჿٙ

Slide 67

Slide 67 text

ņħĦ ĥĤ੥ŀ ąͥ ą ŁᆖĤĥĦĨŇ

Slide 68

Slide 68 text

ܘεɛΥЪ130+&$5ٙࣛࡉ

Slide 69

Slide 69 text

Ңٙˢ༰λ! Ңˢ༰Ϙᄳλ!!!! ᛓҢٙఱ࿁əਢ ฀! ۘݹ਷ᘒ࣌!

Slide 70

Slide 70 text

Ϟࣛࡉᒔึʔʃːႊદйɛٙ

Slide 71

Slide 71 text

ଡ଼ࡰڌͪ....

Slide 72

Slide 72 text

ņħĦ ĥĤ੥ŀ ąͥ ą ŁᆖĤĥĦĨŇ ൴

Slide 73

Slide 73 text

೻όணࠇࢪٙߕᅃ

Slide 74

Slide 74 text

Slide 75

Slide 75 text

No content

Slide 76

Slide 76 text

(*5 The Stupid Content Tracker

Slide 77

Slide 77 text

Ϟλεɛί͜Git Linux Android CakePHP Drupal GIMP jQuery GTK+ Qt phpBB Ruby on Rails PostgreSQL Git

Slide 78

Slide 78 text

ʡჿ݊Git The Stupid Content Tracker งᚉٙʫ࢙৛ᔳኜk و͉છՓӻ୕ ʡჿ݊و͉kܣჿછՓk ࣛΈዚኜ ΫՑཀ̘ ၾ ̻Бࣛ٤

Slide 79

Slide 79 text

މʡჿࠅو͉છՓk াИ܀ɿٙϓڗཀ೻ ӊϣٙһอேٝ༸ਂəʡჿ ҷᙻ೻όʔ͜׊ ̙˸ΝࣛอᄣʔΝ̌ঐdɦʔʝ޴ᅂᚤ ᔊఊ˙کٙମή௪౪ (ԣจ̮dᒔ̙˸ԣʃɛ) ࢙׸ΥЪdҷᙻ೻όٙɛᒔપʔદப΂

Slide 80

Slide 80 text

ʔ Ύ͜ Ꮶ Τ Ⴍ ݂ ԫ

Slide 81

Slide 81 text

ʔᏑkLet’s Do Git!

Slide 82

Slide 82 text

΋Ըఙዧडٙ%FNPыl

Slide 83

Slide 83 text

Gitৎ˓ό git COMMAND [ARGUMENTS] git COMMAND --help #޴຅ྼ͜!! clone - ልႡɛ࢕ٙ repository git clone git://github.com/git/hello-world.git init - ܔͭอٙ repository git init

Slide 84

Slide 84 text

ண֛Git config git config -l git config --global user.name “CrBoy” git config --global user.email “[email protected]” git config --global color.ui auto git config --global alias.st status ~/.gitconfig

Slide 85

Slide 85 text

Gitɛळೌ࢔̬ɽܸ˿ status - ݟ޶ͦۃً࿒ log - ݟ޶া፽ diff - ݟ޶ࢨମ show - ݟ޶त֛و͉

Slide 86

Slide 86 text

Gitٙو͉ Repository, Stage (Index), and Working Copy و͉໮ٙڌͪk HEAD, HEAD~, HEAD~~, HEAD^# Branch Τ၈

Slide 87

Slide 87 text

ܔͭอو͉ add - ਗ਼Ꮶࣩ̋ɝ Stage (Index) commit - ਗ਼ Stage (Index) ٙᏦࣩπɝ Repository و͉ᜊʷ൳ʃ൳λ ഛ͜ status ၾ diff add -p λ͜!!

Slide 88

Slide 88 text

.gitignore ׁଫ̴l ׁଫ̴l ׁଫ̴l ׁଫ̴l ׁଫ̴l ഒ࿁ʔცࠅ஗ॶɝو͉છՓٙᏦࣩ ᅲπᏦeʕගᏦeা፽Ꮶ ͟೻όІਗପ͛ٙᏦࣩɽேʔცࠅو͉છՓ .gitignore வࡈᏦࣩ͉Ԓճk

Slide 89

Slide 89 text

GitࣛΈዚኜ(ၚശਧ!!) checkout - ʲ౬Ցत֛و͉ branch - ପ͛ʱ˕ merge - ፄΥʔΝو͉

Slide 90

Slide 90 text

຅Gitஹɪၣ༩ push - ҪІʉٙ؇Гપ৔̘̈ pull - Ҫйɛٙ؇ГזΫԸ remote - Ⴣ၌޴ᗫ዁Ъ(Ϟܘεsubcommand)

Slide 91

Slide 91 text

“Չ˼f” reset - ᜫ HEAD Ϋ๑Ցत֛و͉ stash - ᅲࣛπɨͦۃ working copydΫՑ HEAD cherry-pick - ܿ̈त֛و͉ٙࡌҷԸ apply blame - ᜑͪͦۃٙӊɓБʫ࢙ίࡳࡈو͉࠯ϣ̈ତ fetch - ՟੻Ⴣ၌ʫ࢙dШʔΥԻΫІʉٙ repo

Slide 92

Slide 92 text

޶logٙλʈՈ git log --graph gitk giggle tig GitX (Mac Only) GitHub.app (Mac Only)

Slide 93

Slide 93 text

Դ͜(JUၾйɛ՘Ъ

Slide 94

Slide 94 text

ɓԬʃҦ̷ ண֛ alias ڭܵ master މ̙͍੬༶Ъو͉ Դ͜ Github ၍ଣண֛Ꮶ

Slide 95

Slide 95 text

Gitၾ׸຾ ؇ဏቍ͖〈׸ሞ〉j˜׸ɓΤϾўɧ່j׸ᔊɓɰiᜊ׸ ɚɰiʔ׸ɧɰf™ ᔊ׸ - Git ᐼ݊׀ྼٙᏍЫা፽ӊࡈو͉ٙ snapshot ᜊ׸ - Դ͜ Git ࣛdو͉ගٙᜊʷʃϾҞ஺ ʔ׸ - া፽ɨԸٙӊࡈو͉ٙʫ࢙༧༟ৃʔึ஗ҷᜊ

Slide 96

Slide 96 text

(JUᒔϞܘε؇Г CVU ΋ึவᅵఱ੄ə

Slide 97

Slide 97 text

࿁ə

Slide 98

Slide 98 text

و͉છՓӻ୕ ʔ݊ '51

Slide 99

Slide 99 text

˜̙ʔ̙˸Ҫ DPEF Ꮐᐵ͂̍ʘܝɪෂՑ HJUk™ œܔᙄɷຬʔࠅவᅵਂdɪϣϞɛவᅵਂdഐ؈ ˜ഐ؈ճk™ œഐ؈৛ᔳʔəو͉dܘʔ˙ک

Slide 100

Slide 100 text

($$  .",& GNU C and C++ Compiler Make

Slide 101

Slide 101 text

No content

Slide 102

Slide 102 text

ԟԬ؇Гேί฀ྒk

Slide 103

Slide 103 text

೻όᇁ ੂБᏦ ?

Slide 104

Slide 104 text

೻όᇁ ੂБᏦ ᇜᙇ ଡ଼ᙇ ஹഐ

Slide 105

Slide 105 text

೻όᇁ ੂБᏦ GCC

Slide 106

Slide 106 text

Ы̙ঐ̥ึ.... $ gcc -o hw1 hw1.c

Slide 107

Slide 107 text

ЫႭʔ֛ᒔึ.... $ gcc -o hw2 main.c a.c b.c

Slide 108

Slide 108 text

Ӛԟჿᔊఊ

Slide 109

Slide 109 text

εᏦʱйᇜᙇ $ gcc -c main.c #ପ͛main.o $ gcc -c a.c #ପ͛a.o $ gcc -c b.c #ପ͛b.o $ gcc -o hw2 main.o a.o b.o

Slide 110

Slide 110 text

޶޶Preprocessorਂəṫk $ gcc -E program.c ̙͜Ըə༆#includeא݊#define࢝කܝٙഐ؈

Slide 111

Slide 111 text

ซ޶ଡ଼ΥႧԊk $ gcc -S program.c ຬɓ...Ң݊Ⴍຬɓ...ຬɓЫซ޶ଡ଼Ⴇٙ༑ਢ....

Slide 112

Slide 112 text

Ϟࣛࡉڢ͜ʔ̙... -I - include (header files) ٙฤర༩ࢰ -O - ௰Գʷ೻ܓ(0~2) -l - ࠅ link ٙ library -L - library ٙฤర༩ࢰ -W* - ᗫ׵ warning ٙ΢၇ண֛ પᑥԴ͜ -Wall !!

Slide 113

Slide 113 text

྅݊வᅵᇜᙇ....? g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4 -I../shared -I/usr/X11R6/ include -I. -o glwidget.o glwidget.cpp g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4 -I../shared -I/usr/X11R6/ include -I. -o main.o main.cpp g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4 -I../shared -I/usr/X11R6/ include -I. -o window.o window.cpp g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4 -I../shared -I/usr/X11R6/ include -I. -o qtlogo.o qtlogo.cpp /usr/bin/moc-qt4 -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/ qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4 -I../shared -I/usr/X11R6/include -I. glwidget.h -o moc_glwidget.cpp g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4 -I../shared -I/usr/X11R6/ include -I. -o moc_glwidget.o moc_glwidget.cpp /usr/bin/moc-qt4 -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/ qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4 -I../shared -I/usr/X11R6/include -I. window.h -o moc_window.cpp g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4 -I../shared -I/usr/X11R6/ include -I. -o moc_window.o moc_window.cpp g++ -o hellogl glwidget.o main.o window.o qtlogo.o moc_glwidget.o moc_window.o -L/usr/lib -L/usr/X11R6/lib -lQtOpenGL - lQtGui -lQtCore -lGLU -lGL -lpthread ɓБɓБ͂kkk

Slide 114

Slide 114 text

No content

Slide 115

Slide 115 text

Make? ᑋ׼eᜳݺeϞᅁ׌ ˙کeҞ஺eԣ˓ಞ

Slide 116

Slide 116 text

.BLFGJMF

Slide 117

Slide 117 text

Makefileٙਿ͉ࡡۆ # #ක᎘ٙڌ̴ͪ݊ൗ༆ targets: prerequisites recipe ... ɓࡈUBCοʩ } ஈଣ˙ό ͦᅺ ΋Ӕૢ΁

Slide 118

Slide 118 text

ᔊఊٙMakefile # ɽ࢕λҢ݊ൗ༆ hw1: hw1.c gcc -o hw1 hw1.c echo “ᇜᙇҁϓ”

Slide 119

Slide 119 text

εᏦᇜᙇ # ɽ࢕λҢ੽࡝࡝ఱ݊ൗ༆ə main.o: main.c gcc -c main.c a.o: a.c gcc -c a.c b.o: b.c gcc -c b.c hw1: main.o a.o b.o gcc -o hw1 main.o a.o b.o

Slide 120

Slide 120 text

Դ͜ᜊᅰ CC = gcc main.o: main.c $(CC) -c main.c a.o: a.c $(CC) -c a.c b.o: b.c $(CC) -c b.c hw1: main.o a.o b.o $(CC) -o hw1 main.o a.o b.o

Slide 121

Slide 121 text

ग़ॕٙୌ໮ - Іਗᜊᅰ CC = gcc %.o: %.c $(CC) -c $< hw1: main.o a.o b.o $(CC) -o $@ main.o a.o b.o ୋɓࡈprerequisite target pattern rule

Slide 122

Slide 122 text

ഛ͜ᜊᅰ CC = gcc CFLAGS = -Wall -O2 OBJS = main.o a.o b.o EXEC = hw1 %.o: %.c $(CC) $(CFLAGS) -c $< $(EXEC): $(OBJS) $(CC) $(CFLAGS) -o $@ $(OBJS)

Slide 123

Slide 123 text

,FSPSP LFSPLFSPLFSPLFSPLFSP

Slide 124

Slide 124 text

%FNPNP EFNPEFNPEFNPEFNP

Slide 125

Slide 125 text

੽ʦ˸ܝ.... $ make g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/ mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/ include/qt4 -I../shared -I/usr/X11R6/include -I. -o glwidget.o glwidget.cpp g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/ mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/ include/qt4 -I../shared -I/usr/X11R6/include -I. -o main.o main.cpp g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/ mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/ include/qt4 -I../shared -I/usr/X11R6/include -I. -o window.o window.cpp g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/ mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/ include/qt4 -I../shared -I/usr/X11R6/include -I. -o qtlogo.o qtlogo.cpp /usr/bin/moc-qt4 -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/ usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4 -I../shared -I/usr/ X11R6/include -I. glwidget.h -o moc_glwidget.cpp g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/ mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/ include/qt4 -I../shared -I/usr/X11R6/include -I. -o moc_glwidget.o moc_glwidget.cpp /usr/bin/moc-qt4 -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/ usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4 -I../shared -I/usr/ X11R6/include -I. window.h -o moc_window.cpp g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/ mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/ include/qt4 -I../shared -I/usr/X11R6/include -I. -o moc_window.o moc_window.cpp ... ... g++ -o hellogl glwidget.o main.o window.o qtlogo.o moc_glwidget.o moc_window.o -L/usr/lib -L/usr/X11R6/lib - lQtOpenGL -lQtGui -lQtCore -lGLU -lGL -lpthread $ _ ɓӉพ֛l

Slide 126

Slide 126 text

(%# The GNU Debugger

Slide 127

Slide 127 text

No content

Slide 128

Slide 128 text

Ы͜ཀ෗k

Slide 129

Slide 129 text

%FCVHHFS̙˸฀ྒk

Slide 130

Slide 130 text

%FCVH

Slide 131

Slide 131 text

͜QSJOUGேܣჿ%FCVHk

Slide 132

Slide 132 text

Ιᜊᅰʫ࢙ Ιչѫ˖ο """ ### 

Slide 133

Slide 133 text

Ιᜊᅰʫ࢙ Ιչѫ˖ο """ ###  ݟ޶ᜊᅰ ္છੂБݴ೻

Slide 134

Slide 134 text

ৰϤʘ̮Ыᒔ̙˸.... ਗ࿒ࡌҷᜊᅰʫ࢙(ᗙ޶ᗙҷ) ਗ࿒ҷᜊੂБݴ೻(ᗙ޶ᗙҷ) ਈ಻ᜊᅰ஗ࡌҷٙ˜ԟࡈmoment™ Ҭ̈೻όᕸદٙ˜ԟࡈmoment™ ҪੂБʕٙ೻ό˜Ҵ™ཀԸdebug ᒔϞԟԬҢɰʔึٙ؇Г

Slide 135

Slide 135 text

%FNP  4FHNFOUBUJPO 'BVMU াኳ᜗ਜݬ፹Ⴌ

Slide 136

Slide 136 text

%FNP  ਗ࿒ࡌҷᜊᅰ࠽

Slide 137

Slide 137 text

੬ܸ͜˿ run - ක֐ੂБ೻ό break - ண֛ʕᓙᓃ continue - ᘱᚃੂБ until - ੂБՑत֛Зໄ next - ɨɓӉ step - ɨɓӉԨ৛ආՌό finish - ੂБՑՌόഐҼ backtrace - ޶call stack frame - ʲ౬frame up / down - ʲ౬frame print / display - ݟ޶ watch - ਈ಻ᅰ࠽ҷᜊ

Slide 138

Slide 138 text

ʃҦ̷ ܸ˿ᐵᄳ gdb --tui A commands - ࿁ʕᓙᓃІਗੂБܸ˿

Slide 139

Slide 139 text

ʔࠅΎࣅQSJOUGԸEFCVHəl

Slide 140

Slide 140 text

ܰৄf

Slide 141

Slide 141 text

7*. Vi IMproved

Slide 142

Slide 142 text

No content

Slide 143

Slide 143 text

Ыᙂ੻ܣᅵٙᇜ፨ኜʑλ͜k

Slide 144

Slide 144 text

No content

Slide 145

Slide 145 text

No content

Slide 146

Slide 146 text

No content

Slide 147

Slide 147 text

No content

Slide 148

Slide 148 text

No content

Slide 149

Slide 149 text

ޟЇ݊

Slide 150

Slide 150 text

No content

Slide 151

Slide 151 text

No content

Slide 152

Slide 152 text

ࡱ

Slide 153

Slide 153 text

No content

Slide 154

Slide 154 text

ӊϣ͂οேࠅ΋ܲ J ٙᇜ፨ኜ

Slide 155

Slide 155 text

7JNᗭ͜ϥə

Slide 156

Slide 156 text

No content

Slide 157

Slide 157 text

ՇɽᎴᓃ

Slide 158

Slide 158 text

කৎԸܘҞ

Slide 159

Slide 159 text

͜ৎԸܘҞ

Slide 160

Slide 160 text

Ңɰฌ͜7JN ணࠇ࿁ͣ

Slide 161

Slide 161 text

'PS &YBNQMF

Slide 162

Slide 162 text

мৰਞᅰ node *Merge(node *h1, node *h2){ node *h, *temp; h = temp = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); while(h1!=NULL && h2!=NULL){ temp = temp->next = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next):(h2=h2->next); } h2 == NULL ? (temp->next=h1) : (temp->next=h2); return h; } _ ದᅺίவ

Slide 163

Slide 163 text

мৰਞᅰ node *Merge(node *h1, node *h2){ node *h, *temp; h = temp = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); while(h1!=NULL && h2!=NULL){ temp = temp->next = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next):(h2=h2->next); } h2 == NULL ? (temp->next=h1) : (temp->next=h2); return h; } _ →

Slide 164

Slide 164 text

мৰਞᅰ node *Merge(node *h1, node *h2){ node *h, *temp; h = temp = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); while(h1!=NULL && h2!=NULL){ temp = temp->next = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next):(h2=h2->next); } h2 == NULL ? (temp->next=h1) : (temp->next=h2); return h; } _ →

Slide 165

Slide 165 text

мৰਞᅰ node *Merge(node *h1, node *h2){ node *h, *temp; h = temp = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); while(h1!=NULL && h2!=NULL){ temp = temp->next = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next):(h2=h2->next); } h2 == NULL ? (temp->next=h1) : (temp->next=h2); return h; } _ →

Slide 166

Slide 166 text

мৰਞᅰ node *Merge(node *h1, node *h2){ node *h, *temp; h = temp = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); while(h1!=NULL && h2!=NULL){ temp = temp->next = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next):(h2=h2->next); } h2 == NULL ? (temp->next=h1) : (temp->next=h2); return h; } _ →

Slide 167

Slide 167 text

мৰਞᅰ node *Merge(node *h1, node *h2){ node *h, *temp; h = temp = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); while(h1!=NULL && h2!=NULL){ temp = temp->next = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next):(h2=h2->next); } h2 == NULL ? (temp->next=h1) : (temp->next=h2); return h; } _ →

Slide 168

Slide 168 text

мৰਞᅰ node *Merge(node *h1, node *h2){ node *h, *temp; h = temp = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); while(h1!=NULL && h2!=NULL){ temp = temp->next = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next):(h2=h2->next); } h2 == NULL ? (temp->next=h1) : (temp->next=h2); return h; } _ Backspace

Slide 169

Slide 169 text

мৰਞᅰ node *Merge(node *h1, node *h){ node *h, *temp; h = temp = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); while(h1!=NULL && h2!=NULL){ temp = temp->next = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next):(h2=h2->next); } h2 == NULL ? (temp->next=h1) : (temp->next=h2); return h; } _ Backspace

Slide 170

Slide 170 text

мৰਞᅰ node *Merge(node *h1, node ){ node *h, *temp; h = temp = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); while(h1!=NULL && h2!=NULL){ temp = temp->next = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next):(h2=h2->next); } h2 == NULL ? (temp->next=h1) : (temp->next=h2); return h; } _ Backspace

Slide 171

Slide 171 text

мৰਞᅰ node *Merge(node *h1, no){ node *h, *temp; h = temp = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); while(h1!=NULL && h2!=NULL){ temp = temp->next = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next):(h2=h2->next); } h2 == NULL ? (temp->next=h1) : (temp->next=h2); return h; } _ Backspace

Slide 172

Slide 172 text

мৰਞᅰ node *Merge(node *h1){ node *h, *temp; h = temp = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); while(h1!=NULL && h2!=NULL){ temp = temp->next = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next):(h2=h2->next); } h2 == NULL ? (temp->next=h1) : (temp->next=h2); return h; } _ Backspace

Slide 173

Slide 173 text

мৰਞᅰ node *Merge(nod){ node *h, *temp; h = temp = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); while(h1!=NULL && h2!=NULL){ temp = temp->next = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next):(h2=h2->next); } h2 == NULL ? (temp->next=h1) : (temp->next=h2); return h; } _ Backspace

Slide 174

Slide 174 text

мৰਞᅰ node *Merge(){ node *h, *temp; h = temp = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); while(h1!=NULL && h2!=NULL){ temp = temp->next = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next):(h2=h2->next); } h2 == NULL ? (temp->next=h1) : (temp->next=h2); return h; } _ Backspace

Slide 175

Slide 175 text

мৰਞᅰ In Vim node *Merge(node *h1, node *h2){ node *h, *temp; h = temp = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); while(h1!=NULL && h2!=NULL){ temp = temp->next = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next):(h2=h2->next); } h2 == NULL ? (temp->next=h1) : (temp->next=h2); return h; } _ ದᅺίவ

Slide 176

Slide 176 text

мৰਞᅰ In Vim node *Merge(node *h1, node *h2){ node *h, *temp; h = temp = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); while(h1!=NULL && h2!=NULL){ temp = temp->next = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next):(h2=h2->next); } h2 == NULL ? (temp->next=h1) : (temp->next=h2); return h; } _ d i (

Slide 177

Slide 177 text

мৰਞᅰ In Vim node *Merge(){ node *h, *temp; h = temp = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); while(h1!=NULL && h2!=NULL){ temp = temp->next = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next):(h2=h2->next); } h2 == NULL ? (temp->next=h1) : (temp->next=h2); return h; } _ ҁϓ

Slide 178

Slide 178 text

ֻɨ୅5Б node *Merge(){ node *h, *temp; h = temp = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); while(h1!=NULL && h2!=NULL){ temp = temp->next = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next):(h2=h2->next); } h2 == NULL ? (temp->next=h1) : (temp->next=h2); return h; } _ ದᅺίவ

Slide 179

Slide 179 text

ֻɨ୅5Б node *Merge(){ node *h, *temp; h = temp = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); while(h1!=NULL && h2!=NULL){ temp = temp->next = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next):(h2=h2->next); } h2 == NULL ? (temp->next=h1) : (temp->next=h2); return h; } _ ↓

Slide 180

Slide 180 text

ֻɨ୅5Б node *Merge(){ node *h, *temp; h = temp = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); while(h1!=NULL && h2!=NULL){ temp = temp->next = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next):(h2=h2->next); } h2 == NULL ? (temp->next=h1) : (temp->next=h2); return h; } _ ↓

Slide 181

Slide 181 text

ֻɨ୅5Б node *Merge(){ node *h, *temp; h = temp = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); while(h1!=NULL && h2!=NULL){ temp = temp->next = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next):(h2=h2->next); } h2 == NULL ? (temp->next=h1) : (temp->next=h2); return h; } _ ↓

Slide 182

Slide 182 text

ֻɨ୅5Б node *Merge(){ node *h, *temp; h = temp = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); while(h1!=NULL && h2!=NULL){ temp = temp->next = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next):(h2=h2->next); } h2 == NULL ? (temp->next=h1) : (temp->next=h2); return h; } _ ↓

Slide 183

Slide 183 text

ֻɨ୅5Б node *Merge(){ node *h, *temp; h = temp = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); while(h1!=NULL && h2!=NULL){ temp = temp->next = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next):(h2=h2->next); } h2 == NULL ? (temp->next=h1) : (temp->next=h2); return h; } _ ↓

Slide 184

Slide 184 text

ֻɨ୅5Б node *Merge(){ node *h, *temp; h = temp = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); while(h1!=NULL && h2!=NULL){ temp = temp->next = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next):(h2=h2->next); } h2 == NULL ? (temp->next=h1) : (temp->next=h2); return h; } _ ದᅺίவ

Slide 185

Slide 185 text

ֻɨ୅5Б In Vim node *Merge(){ node *h, *temp; h = temp = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); while(h1!=NULL && h2!=NULL){ temp = temp->next = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next):(h2=h2->next); } h2 == NULL ? (temp->next=h1) : (temp->next=h2); return h; } _ ದᅺίவ

Slide 186

Slide 186 text

ֻɨ୅5Б In Vim node *Merge(){ node *h, *temp; h = temp = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); while(h1!=NULL && h2!=NULL){ temp = temp->next = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next):(h2=h2->next); } h2 == NULL ? (temp->next=h1) : (temp->next=h2); return h; } _ 5 j

Slide 187

Slide 187 text

ֻɨ୅5Б In Vim node *Merge(){ node *h, *temp; h = temp = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); while(h1!=NULL && h2!=NULL){ temp = temp->next = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next):(h2=h2->next); } h2 == NULL ? (temp->next=h1) : (temp->next=h2); return h; } _ ҁϓ

Slide 188

Slide 188 text

мৰ”temp->next =” node *Merge(){ node *h, *temp; h = temp = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); while(h1!=NULL && h2!=NULL){ temp = temp->next = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next):(h2=h2->next); } h2 == NULL ? (temp->next=h1) : (temp->next=h2); return h; } _ ದᅺίவ

Slide 189

Slide 189 text

мৰ”temp->next =” node *Merge(){ node *h, *temp; h = temp = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); while(h1!=NULL && h2!=NULL){ temp = temp->next = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next):(h2=h2->next); } h2 == NULL ? (temp->next=h1) : (temp->next=h2); return h; } _ Del

Slide 190

Slide 190 text

мৰ”temp->next =” node *Merge(){ node *h, *temp; h = temp = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); while(h1!=NULL && h2!=NULL){ temp = p->next = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next):(h2=h2->next); } h2 == NULL ? (temp->next=h1) : (temp->next=h2); return h; } _ Del

Slide 191

Slide 191 text

мৰ”temp->next =” node *Merge(){ node *h, *temp; h = temp = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); while(h1!=NULL && h2!=NULL){ temp = ext = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next):(h2=h2->next); } h2 == NULL ? (temp->next=h1) : (temp->next=h2); return h; } _ Del

Slide 192

Slide 192 text

мৰ”temp->next =” node *Merge(){ node *h, *temp; h = temp = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); while(h1!=NULL && h2!=NULL){ temp = = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next):(h2=h2->next); } h2 == NULL ? (temp->next=h1) : (temp->next=h2); return h; } _ Del

Slide 193

Slide 193 text

мৰ”temp->next =” node *Merge(){ node *h, *temp; h = temp = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); while(h1!=NULL && h2!=NULL){ temp = ->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next):(h2=h2->next); } h2 == NULL ? (temp->next=h1) : (temp->next=h2); return h; } _ Del

Slide 194

Slide 194 text

мৰ”temp->next =” node *Merge(){ node *h, *temp; h = temp = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); while(h1!=NULL && h2!=NULL){ temp = ->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next):(h2=h2->next); } h2 == NULL ? (temp->next=h1) : (temp->next=h2); return h; } _ мཀ᎘ə

Slide 195

Slide 195 text

мৰ”temp->next =” node *Merge(){ node *h, *temp; h = temp = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); while(h1!=NULL && h2!=NULL){ temp = 1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next):(h2=h2->next); } h2 == NULL ? (temp->next=h1) : (temp->next=h2); return h; } _ Ctrl z

Slide 196

Slide 196 text

мৰ”temp->next =” node *Merge(){ node *h, *temp; h = temp = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); while(h1!=NULL && h2!=NULL){ temp = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next):(h2=h2->next); } h2 == NULL ? (temp->next=h1) : (temp->next=h2); return h; } _ Ctrl z

Slide 197

Slide 197 text

мৰ”temp->next =” In Vim node *Merge(){ node *h, *temp; h = temp = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); while(h1!=NULL && h2!=NULL){ temp = temp->next = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next):(h2=h2->next); } h2 == NULL ? (temp->next=h1) : (temp->next=h2); return h; } _ ದᅺίவ

Slide 198

Slide 198 text

мৰ”temp->next =” In Vim node *Merge(){ node *h, *temp; h = temp = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); while(h1!=NULL && h2!=NULL){ temp = temp->next = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next):(h2=h2->next); } h2 == NULL ? (temp->next=h1) : (temp->next=h2); return h; } _ d f =

Slide 199

Slide 199 text

мৰ”temp->next =” In Vim node *Merge(){ node *h, *temp; h = temp = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next) : (h2=h2->next); while(h1!=NULL && h2!=NULL){ temp = h1->data < h2->data ? h1 : h2; h1->data < h2->data ? (h1=h1->next):(h2=h2->next); } h2 == NULL ? (temp->next=h1) : (temp->next=h2); return h; } _ ҁϓ

Slide 200

Slide 200 text

ኪ୦7JN

Slide 201

Slide 201 text

ୋɓӉjԴ̴͜l

Slide 202

Slide 202 text

ண֛Vim - .vimrc set number syntax on set autoindent set tabstop=4 set shiftwidth=4 set showcmd

Slide 203

Slide 203 text

Vim୅ਗ (motion) hjkl - ʔ͜ߠd͜Ԓ᜗̘াl w, e, b and W, E, B 0, ^, $ f, F, t, T #G and gg

Slide 204

Slide 204 text

ࠠል ٜટႭࠅࠠል఻ϣ!! Է 10j - Σɨ୅ਗ10Б 5yy - ልႡ5Б 30x - мৰ30ࡈοʩ yy5p - ልႡவБԨ൨ɪ5ϣ

Slide 205

Slide 205 text

ࡌҷʫ࢙ d - delete (мৰא਒ɨ) y - yank (ልႡ) p - paste (൨ɪ) x, X - мৰοʩ r - replace (՟˾οʩ) u, - Undo, Redo (ూࡡၾ՟ऊూࡡ)

Slide 206

Slide 206 text

፩ɝ˖ο i - insert a - append o - begin a new line c - change I, A, O, C

Slide 207

Slide 207 text

ʃҦ̷jLFSPLFSPLFSPLFSPLFSP

Slide 208

Slide 208 text

ฤరၾ՟˾ / - ֻۃฤర ? - ֻΫฤర *, # - ฤరఊο :%s/A/B/g - ҪהϞٙA՟˾ϓB ฤరᒔʔ̥வᅵ!!

Slide 209

Slide 209 text

ʃҦ̷j[[ ၾ [FOUFS

Slide 210

Slide 210 text

ʃҦ̷j7JNࣣᜀ NBSL

Slide 211

Slide 211 text

ʃҦ̷j$/$1Іਗҁϓ

Slide 212

Slide 212 text

ʃҦ̷jHH(

Slide 213

Slide 213 text

ࠠࠅҦ̷ IFMQ TPNFUIJOH

Slide 214

Slide 214 text

ࠠࠅᝈׂ ഒ࿁ʔࠅΌ௅ߠɨԸ

Slide 215

Slide 215 text

Vim˖οي΁ Text Object ˖ο༧ي΁Ϟʡჿᗫڷk Operator + (i or a) + Region Indicator diw, daw - мৰɓࡈο(word) di{, da{ d2i{

Slide 216

Slide 216 text

Νࣛᇜ፨εࡈᏦࣩ spilt vsplit tabpage tabnew tabe[dit] gt, gT, #gt

Slide 217

Slide 217 text

Quickfix Window ࿁೻όක೯٫޴຅ྼ͜!! make grep copen, cclose cnext, cprevious

Slide 218

Slide 218 text

೻όᇁ࿡ᛌ(Folding) set foldmethod=syntax foldlevel=8 zc, zo, za

Slide 219

Slide 219 text

˖οᇜᇁਪᕚ Windowsɪٙʕ˖ᏦࣩࣅՑLinuxఱᜊ඾ᇁk set fileencodings=utf-8,big5 - Ꮶࣩᇜᇁ set encoding=utf-8 - ʫ௅ᇜᇁ set termencoding=utf-8 - ୞၌ዚᇜᇁ ӊБٙഐ҈Ϟ׉׉ٙ؇Гk set fileformats=unix,dos

Slide 220

Slide 220 text

Іʉண֛Ҟઠᒟl Key Mapping map nmap imap vmap (ᒔϞйٙ)

Slide 221

Slide 221 text

̮ન೻ό(Plug-ins) Ϟ൴ॴ൴ॴεٙ Vim ̮ન̙˸͜ NERDTree Tagbar snipMate Completion: neocomplcache, OminCppComplete ......

Slide 222

Slide 222 text

7JNɰϞྡҖʧࠦ  (7JN

Slide 223

Slide 223 text

7JNܘλܘ੶ɽ ணࠇ࿁ͣ

Slide 224

Slide 224 text

ഐႧ ̙˸ʔึ vimdШ݊ࠅܿࡈλٙ͜ᇜ፨ኜf ̙˸ʔᏑ gcc ༧ makedШ݊йᜫІʉᇜᙇՑଢ଼ϥf ̙˸ʔ͜ gdbdШ݊ࠅܿࡈ debugger Ը͜f ̙˸ʔ፯ gitdШ݊ɓ֛ࠅϞو͉છՓ˙ࣩf ኪ୦ᜊᑋ׼dʔࠅ˄рɢf

Slide 225

Slide 225 text

THANK YOU FOR YOUR ATTENSION 3Q =) by CrBoy 2012.03...

Slide 226

Slide 226 text

͉ᔊజ͟ଭ͗ݰ (CrBoy) ႡЪ ˸௴͜CC ֑Τᅺͪ-޴Ν˙όʱԮ 3.0 ̨ᝄ બᛆૢಛᙑ̈ ᛇڎ΂ОҖόʘࠠႡe౳бၾࡌҷdШሗ׼ᜑᅺൗЪ٫֑ΤeIDၾE-maildԨ˸޴Νબᛆૢಛਗ਼ࠃ͛Ъۜᙑ̈ ᔊజʕהˏ͜ʘྡ˪ၾਠᅺ௅ʱᓘ՟Іၣყၣ༩dՉᛆлޫʱ᙮΢༈ʮ̡אഹЪɛהϞ