Slide 1

Slide 1 text

ᄳ೻όkԟԬϼࢪӚ઺ٙԫ Code Smart, Don’t Code Hard Release  !4UVEZ"SFB5BJDIVOH ଭ͗ݰ ʃଭ$S#PZ DSCPZ!DSCPZOFU

Slide 2

Slide 2 text

ίක֐ʘۃ... й׊lεਪਪᕚl ʦ˂̥ਂ୑૵ᔊʧdШܘᛇڎଉɝীሞl ν؈̈ତи३༑...ࠅ३l І͟ආ̈ɪఽהᑺ˓ዚאွᙂ εਪਪᕚl й׊l ຬɓᑺ˄ɮ̙˸೯ਪ˜ሗਪ఻ᓃɨሙk™XD

Slide 3

Slide 3 text

Ң݊ምk

Slide 4

Slide 4 text

຾ዝ 2007 ϋϓɽ༟ʈӻ೻όணࠇᘩᒄ-Ꮄഃ 2007 ϋΌ਷ɽਖ਼ཥ໘ழ᜗ணࠇᘩᒄ͠ଡ଼-ԳЪ 2007 ϋ ACM ICPC ԭݲਜ̨ᝄᒄਜ-ୋ 13 Τ 2008 ϋୋɧ֣یਜɽਖ਼৫ࣧ೻όணࠇᘩᒄ-ආචଡ଼ୋɓΤ 2008 ϋϓɽ༟ʈӻ೻όணࠇᘩᒄආචଡ଼-ୋɓΤ ՘፬ Ubuntu-TW ໊ٟΌ̨޴ᗫݺਗ 2007 - ԙʦ 2008 ϋගd׵ӻʫІБ˴ᑺᅰఙ C ႧԊਿᓾᝈׂ઺ኪሙ೻ 2008 ϋΌ਷ɽਖ਼ཥ໘ழ᜗ணࠇᘩᒄ͠ଡ଼-ୋɧΤ ˴ᑺ˜UܘɽdUʔ͜፺ - Ubuntu Linux ʧୗ™׵਷ͭϓ̌ɽኪ (http://goo.gl/lEnCN) 2009/03/24 ˴ᑺ˜MozTW & Ubuntu І͟อ͛˾™׵৷ඪᏐ͜߅Ҧɽኪ (http://goo.gl/CgtBK) 2009/07/13 ˴ᑺ˜Ubuntu Linux ᔊʧ™׵̨ی̬ࣧ༟ৃٟྠᑌΥڎอ 2009/10/31 ˜І͟ழ᜗Ꮠ͜ၾ઺ኪ™׵ථ؍ጤɹಳ਷ʃ 2010/01/21 2010 ϋ̨ᝄᎡ܄ϋึ ఙਕଡ଼ʈЪɛࡰ Ubuntu-TW ໊ٟ˖΁ଡ଼(Doc Team)ࠋபɛ 2010/10 - ԙʦ 2011 ϋ̨ᝄᎡ܄ϋึ ఙਕଡ଼ʈЪɛࡰ 2011 ϋක๕ɛϋึ ఙਕଡ଼ʈЪɛࡰ 2011 ϋ༟τҦঐږ޷ᆤ-ୋɧΤ ˴ᑺ˜ԟԬϼࢪӚ઺ٙԫ - Code Smart, Don’t Code hard™׵਷ͭϓ̌ɽኪ 2012/03/29

Slide 5

Slide 5 text

ତί݊͂ᕏٙ

Slide 6

Slide 6 text

ԟЫ݊ምk

Slide 7

Slide 7 text

Ыމʡჿίவk

Slide 8

Slide 8 text

ʦ˂Ңࡁ˸ $ ႧԊމ˴

Slide 9

Slide 9 text

Ϟ٤ٙ༑ΎԸᓃ 1)1

Slide 10

Slide 10 text

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

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

??

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

ԟ%FCVHճk

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

No content

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

಻༊ৃࢹΙ˄εk

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

No content

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

No content

Slide 38

Slide 38 text

No content

Slide 39

Slide 39 text

No content

Slide 40

Slide 40 text

Ыॆٙܘрɢ Ꮀ

Slide 41

Slide 41 text

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

Slide 42

Slide 42 text

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

Slide 43

Slide 43 text

Ыɦක֐рɢ

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){ * 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 45

Slide 45 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 46

Slide 46 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 47

Slide 47 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 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"); อᄣl мৰl

Slide 49

Slide 49 text

ЫڀəՇ˂

Slide 50

Slide 50 text

ഐ؈̌ঐᄳᙻə

Slide 51

Slide 51 text

ɦڀՇ˂ҪDPEFҷΫԸ

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; ! (*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 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){ ! 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 54

Slide 54 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 55

Slide 55 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 56

Slide 56 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 57

Slide 57 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 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

No content

Slide 67

Slide 67 text

No content

Slide 68

Slide 68 text

No content

Slide 69

Slide 69 text

No content

Slide 70

Slide 70 text

ᒔϞ͜&YDFMা፽ҷəʡჿٙ

Slide 71

Slide 71 text

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

Slide 72

Slide 72 text

ܘεɛΥЪ1SPKFDUٙࣛࡉ

Slide 73

Slide 73 text

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

Slide 74

Slide 74 text

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

Slide 75

Slide 75 text

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

Slide 76

Slide 76 text

೻όணࠇࢪٙߕᅃ

Slide 77

Slide 77 text

Slide 78

Slide 78 text

(*5 The Stupid Content Tracker

Slide 79

Slide 79 text

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

Slide 80

Slide 80 text

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

Slide 81

Slide 81 text

வఱ݊و͉

Slide 82

Slide 82 text

ϞɞϓࠠልٙᏦࣩ Ͼ˲ʔٝ༸ࢨίࡳ༁

Slide 83

Slide 83 text

No content

Slide 84

Slide 84 text

ה˸ࠅછՓ

Slide 85

Slide 85 text

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

Slide 86

Slide 86 text

ʔ Ύ͜ Ꮶ Τ Ⴍ ݂ ԫ

Slide 87

Slide 87 text

ʔᏑkLet’s Do Git!

Slide 88

Slide 88 text

΋Ըఙዧडٙ%FNPыl

Slide 89

Slide 89 text

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

Slide 90

Slide 90 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 91

Slide 91 text

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

Slide 92

Slide 92 text

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

Slide 93

Slide 93 text

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

Slide 94

Slide 94 text

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

Slide 95

Slide 95 text

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

Slide 96

Slide 96 text

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

Slide 97

Slide 97 text

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

Slide 98

Slide 98 text

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

Slide 99

Slide 99 text

Դ͜(JUၾйɛ՘Ъ

Slide 100

Slide 100 text

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

Slide 101

Slide 101 text

(JU ၾ 8JOEPXT

Slide 102

Slide 102 text

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

Slide 103

Slide 103 text

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

Slide 104

Slide 104 text

࿁ə

Slide 105

Slide 105 text

و͉છՓӻ୕ ʔ݊ '51

Slide 106

Slide 106 text

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

Slide 107

Slide 107 text

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

Slide 108

Slide 108 text

No content

Slide 109

Slide 109 text

ԟԬ؇Гேί฀ྒk

Slide 110

Slide 110 text

೻όᇁ ੂБᏦ ?

Slide 111

Slide 111 text

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

Slide 112

Slide 112 text

೻όᇁ ੂБᏦ GCC

Slide 113

Slide 113 text

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

Slide 114

Slide 114 text

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

Slide 115

Slide 115 text

Ӛԟჿᔊఊ

Slide 116

Slide 116 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 117

Slide 117 text

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

Slide 118

Slide 118 text

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

Slide 119

Slide 119 text

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

Slide 120

Slide 120 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 121

Slide 121 text

No content

Slide 122

Slide 122 text

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

Slide 123

Slide 123 text

.BLFGJMF

Slide 124

Slide 124 text

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

Slide 125

Slide 125 text

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

Slide 126

Slide 126 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 127

Slide 127 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 128

Slide 128 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 129

Slide 129 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 130

Slide 130 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 131

Slide 131 text

ᒔ݊ʔࠅ %&.0 ыk

Slide 132

Slide 132 text

ᒔϞࡈ؇Г̣ $.BLF

Slide 133

Slide 133 text

(%# The GNU Debugger

Slide 134

Slide 134 text

No content

Slide 135

Slide 135 text

Ы͜ཀ෗k

Slide 136

Slide 136 text

%FCVHHFS̙˸฀ྒk

Slide 137

Slide 137 text

%FCVH

Slide 138

Slide 138 text

͜QSJOUGேܣჿ%FCVHk

Slide 139

Slide 139 text

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

Slide 140

Slide 140 text

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

Slide 141

Slide 141 text

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

Slide 142

Slide 142 text

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

Slide 143

Slide 143 text

%FNP  ਗ࿒ࡌҷᜊᅰ࠽

Slide 144

Slide 144 text

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

Slide 145

Slide 145 text

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

Slide 146

Slide 146 text

ʔࠅΎࣅQSJOUGԸEFCVHəl

Slide 147

Slide 147 text

ܰৄf

Slide 148

Slide 148 text

130'*-*/( GNU gprof

Slide 149

Slide 149 text

Դ͜˙ό gcc -pg -o program program.c ./program # ึପ͛ gmon.out Ꮶ gprof program # ʔ݊ gprof gmon.out

Slide 150

Slide 150 text

7*. Vi IMproved

Slide 151

Slide 151 text

 ՟ऊ౽ღۨ UBC

Slide 152

Slide 152 text

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

Slide 153

Slide 153 text

No content

Slide 154

Slide 154 text

No content

Slide 155

Slide 155 text

No content

Slide 156

Slide 156 text

No content

Slide 157

Slide 157 text

No content

Slide 158

Slide 158 text

ޟЇ݊

Slide 159

Slide 159 text

No content

Slide 160

Slide 160 text

No content

Slide 161

Slide 161 text

ࡱ

Slide 162

Slide 162 text

No content

Slide 163

Slide 163 text

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

Slide 164

Slide 164 text

7JNᗭ͜ϥə

Slide 165

Slide 165 text

ҢኪҔٙႭج

Slide 166

Slide 166 text

No content

Slide 167

Slide 167 text

ՇɽᎴᓃ

Slide 168

Slide 168 text

කৎԸܘҞ

Slide 169

Slide 169 text

͜ৎԸܘҞ

Slide 170

Slide 170 text

Ңɰฌ͜7JN ணࠇ࿁ͣ

Slide 171

Slide 171 text

'PS &YBNQMF

Slide 172

Slide 172 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 173

Slide 173 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 174

Slide 174 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 175

Slide 175 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 176

Slide 176 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 177

Slide 177 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 178

Slide 178 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 179

Slide 179 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 180

Slide 180 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 181

Slide 181 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 182

Slide 182 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 183

Slide 183 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 184

Slide 184 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 185

Slide 185 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 186

Slide 186 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 187

Slide 187 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 188

Slide 188 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 189

Slide 189 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 190

Slide 190 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 191

Slide 191 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 192

Slide 192 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 193

Slide 193 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 194

Slide 194 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 195

Slide 195 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 196

Slide 196 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 197

Slide 197 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 198

Slide 198 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 199

Slide 199 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 200

Slide 200 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 201

Slide 201 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 202

Slide 202 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 203

Slide 203 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 204

Slide 204 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 205

Slide 205 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 206

Slide 206 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 207

Slide 207 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 208

Slide 208 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 209

Slide 209 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 210

Slide 210 text

ኪ୦7JN

Slide 211

Slide 211 text

ୋɓӉjԴ̴͜l

Slide 212

Slide 212 text

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

Slide 213

Slide 213 text

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

Slide 214

Slide 214 text

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

Slide 215

Slide 215 text

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

Slide 216

Slide 216 text

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

Slide 217

Slide 217 text

ʃҦ̷jLFSPLFSPLFSPLFSPLFSP

Slide 218

Slide 218 text

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

Slide 219

Slide 219 text

ʃҦ̷j[[ ၾ [FOUFS

Slide 220

Slide 220 text

ʃҦ̷j7JNࣣᜀ NBSL

Slide 221

Slide 221 text

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

Slide 222

Slide 222 text

ʃҦ̷jHH(

Slide 223

Slide 223 text

ࠠࠅҦ̷ IFMQ TPNFUIJOH

Slide 224

Slide 224 text

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

Slide 225

Slide 225 text

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

Slide 226

Slide 226 text

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

Slide 227

Slide 227 text

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

Slide 228

Slide 228 text

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

Slide 229

Slide 229 text

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

Slide 230

Slide 230 text

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

Slide 231

Slide 231 text

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

Slide 232

Slide 232 text

7JNɰϞྡҖʧࠦ  (7JN

Slide 233

Slide 233 text

7JNܘλܘ੶ɽ ணࠇ࿁ͣ

Slide 234

Slide 234 text

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

Slide 235

Slide 235 text

Νఙ݈̋ ν؈Ңᄳٙ݊Չ˼ႧԊk

Slide 236

Slide 236 text

ቇ͜Չ˼ႧԊٙʈՈ VimeGit ༧ make ݊ஷٙ͜l ϓᆞٙႧԊᏐ༈ேึϞࡈ Debugger ༧ Profiler C/C++jGDBeGProf PHPjXdebug PythonjPDB JavaScriptjFirebugeChrome Developer Tools

Slide 237

Slide 237 text

5IBOL :PV GPS :PVS "UUFOTJPO 3Q =) by CrBoy 2012.07.15...

Slide 238

Slide 238 text

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