Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Code Smart, Don't Code hard

crboy
March 30, 2012
11k

Code Smart, Don't Code hard

crboy

March 30, 2012
Tweet

Transcript

  1. ??

  2. ҢϞࣛࡉܘฌ͜ XDrz debug ج printf("XD"); /* do many things */

    printf("rz\n"); ν؈ӚԒ᜗ఱ݊ݔࡈή˙ᖑદəXD XD ɰ݊ɓם
  3. /*¶®•\§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 <stdio.h> 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(data<p->data){ * * temp = (node*)malloc(sizeof(node)); * * temp->data = data; * * temp->next = p; * * return temp; * } * if(t!=NULL) * * while(data<p->data || 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"); }
  4. /*¶®•\§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 <stdio.h> 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(data<p->data){ * * temp = (node*)malloc(sizeof(node)); * * temp->data = data; * * temp->next = p; * * return temp; * } * if(t!=NULL) * * while(data<p->data || 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
  5. /*¶®•\§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 <stdio.h> 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(data<p->data){ * * temp = (node*)malloc(sizeof(node)); * * temp->data = data; * * temp->next = p; * * return temp; * } * if(t!=NULL) * * while(data<p->data || 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
  6. /*¶®•\§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 <stdio.h> 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(data<p->data){ * * temp = (node*)malloc(sizeof(node)); * * temp->data = data; * * temp->next = p; * * return temp; * } * if(t!=NULL) * * while(data<p->data || 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
  7. /*¶®•\§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 <stdio.h> 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(data<p->data){ * * temp = (node*)malloc(sizeof(node)); * * temp->data = data; * * temp->next = p; * * return temp; * } * if(t!=NULL) * * while(data<p->data || 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
  8. /*¶®•\§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 <stdio.h> 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(data<p->data){ * * temp = (node*)malloc(sizeof(node)); * * temp->data = data; * * temp->next = p; * * return temp; * } * if(t!=NULL) * * while(data<p->data || 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");
  9. /*¶®•\§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 <stdio.h> 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(data<p->data){ * * temp = (node*)malloc(sizeof(node)); * * temp->data = data; * * temp->next = p; * * return temp; * } * if(t!=NULL) * * while(data<p->data || 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
  10. /*¶®•\§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 <stdio.h> 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(data<p->data){ * * temp = (node*)malloc(sizeof(node)); * * temp->data = data; * * temp->next = p; * * return temp; * } * if(t!=NULL) * * while(data<p->data || 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
  11. /*¶®•\§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 <stdio.h> 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(data<p->data){ * * temp = (node*)malloc(sizeof(node)); * * temp->data = data; * * temp->next = p; * * return temp; * } * if(t!=NULL) * * while(data<p->data || 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
  12. /*¶®•\§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 <stdio.h> 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(data<p->data){ * * temp = (node*)malloc(sizeof(node)); * * temp->data = data; * * temp->next = p; * * return temp; * } * if(t!=NULL) * * while(data<p->data || 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
  13. /*¶®•\§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 <stdio.h> 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(data<p->data){ * * temp = (node*)malloc(sizeof(node)); * * temp->data = data; * * temp->next = p; * * return temp; * } * if(t!=NULL) * * while(data<p->data || 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
  14. Gitৎ˓ό git COMMAND [ARGUMENTS] git COMMAND --help #޴຅ྼ͜!! clone -

    ልႡɛ࢕ٙ repository git clone git://github.com/git/hello-world.git init - ܔͭอٙ repository git init
  15. ண֛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
  16. ܔͭอو͉ add - ਗ਼Ꮶࣩ̋ɝ Stage (Index) commit - ਗ਼ Stage

    (Index) ٙᏦࣩπɝ Repository و͉ᜊʷ൳ʃ൳λ ഛ͜ status ၾ diff add -p λ͜!!
  17. “Չ˼f” reset - ᜫ HEAD Ϋ๑Ցत֛و͉ stash - ᅲࣛπɨͦۃ working

    copydΫՑ HEAD cherry-pick - ܿ̈त֛و͉ٙࡌҷԸ apply blame - ᜑͪͦۃٙӊɓБʫ࢙ίࡳࡈو͉࠯ϣ̈ତ fetch - ՟੻Ⴣ၌ʫ࢙dШʔΥԻΫІʉٙ repo
  18. εᏦʱйᇜᙇ $ 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
  19. Ϟࣛࡉڢ͜ʔ̙... -I - include (header files) ٙฤర༩ࢰ -O - ௰Գʷ೻ܓ(0~2)

    -l - ࠅ link ٙ library -L - library ٙฤర༩ࢰ -W* - ᗫ׵ warning ٙ΢၇ண֛ પᑥԴ͜ -Wall !!
  20. ྅݊வᅵᇜᙇ....? 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
  21. εᏦᇜᙇ # ɽ࢕λҢ੽࡝࡝ఱ݊ൗ༆ə 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
  22. Դ͜ᜊᅰ 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
  23. ग़ॕٙୌ໮ - Іਗᜊᅰ 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
  24. ഛ͜ᜊᅰ 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)
  25. ੽ʦ˸ܝ.... $ 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
  26. ੬ܸ͜˿ run - ක֐ੂБ೻ό break - ண֛ʕᓙᓃ continue - ᘱᚃੂБ

    until - ੂБՑत֛Зໄ next - ɨɓӉ step - ɨɓӉԨ৛ආՌό finish - ੂБՑՌόഐҼ backtrace - ޶call stack frame - ʲ౬frame up / down - ʲ౬frame print / display - ݟ޶ watch - ਈ಻ᅰ࠽ҷᜊ
  27. мৰਞᅰ 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; } _ ದᅺίவ
  28. мৰਞᅰ 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; } _ →
  29. мৰਞᅰ 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; } _ →
  30. мৰਞᅰ 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; } _ →
  31. мৰਞᅰ 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; } _ →
  32. мৰਞᅰ 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; } _ →
  33. мৰਞᅰ 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
  34. мৰਞᅰ 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
  35. мৰਞᅰ 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
  36. мৰਞᅰ 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
  37. мৰਞᅰ 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
  38. мৰਞᅰ 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
  39. мৰਞᅰ 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
  40. мৰਞᅰ 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; } _ ದᅺίவ
  41. мৰਞᅰ 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 (
  42. мৰਞᅰ 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; } _ ҁϓ
  43. ֻɨ୅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; } _ ದᅺίவ
  44. ֻɨ୅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; } _ ↓
  45. ֻɨ୅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; } _ ↓
  46. ֻɨ୅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; } _ ↓
  47. ֻɨ୅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; } _ ↓
  48. ֻɨ୅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; } _ ↓
  49. ֻɨ୅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; } _ ದᅺίவ
  50. ֻɨ୅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; } _ ದᅺίவ
  51. ֻɨ୅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
  52. ֻɨ୅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; } _ ҁϓ
  53. мৰ”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; } _ ದᅺίவ
  54. мৰ”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
  55. мৰ”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
  56. мৰ”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
  57. мৰ”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
  58. мৰ”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
  59. мৰ”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; } _ мཀ᎘ə
  60. мৰ”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
  61. мৰ”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
  62. мৰ”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; } _ ದᅺίவ
  63. мৰ”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 =
  64. мৰ”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; } _ ҁϓ
  65. ண֛Vim - .vimrc set number syntax on set autoindent set

    tabstop=4 set shiftwidth=4 set showcmd
  66. ࡌҷʫ࢙ d - delete (мৰא਒ɨ) y - yank (ልႡ) p

    - paste (൨ɪ) x, X - мৰοʩ r - replace (՟˾οʩ) u, <C-r> - Undo, Redo (ూࡡၾ՟ऊూࡡ)
  67. ፩ɝ˖ο i - insert a - append o - begin

    a new line c - change I, A, O, C
  68. ฤరၾ՟˾ / - ֻۃฤర ? - ֻΫฤర *, # -

    ฤరఊο :%s/A/B/g - ҪהϞٙA՟˾ϓB ฤరᒔʔ̥வᅵ!!
  69. Vim˖οي΁ Text Object ˖ο༧ي΁Ϟʡჿᗫڷk Operator + (i or a) +

    Region Indicator diw, daw - мৰɓࡈο(word) di{, da{ d2i{
  70. ˖οᇜᇁਪᕚ Windowsɪٙʕ˖ᏦࣩࣅՑLinuxఱᜊ඾ᇁk set fileencodings=utf-8,big5 - Ꮶࣩᇜᇁ set encoding=utf-8 - ʫ௅ᇜᇁ

    set termencoding=utf-8 - ୞၌ዚᇜᇁ ӊБٙഐ҈Ϟ׉׉ٙ؇Гk set fileformats=unix,dos