* Name: Elvis Bodeci * Matricola: A219407109 * Email: elvisbodeci@hotmail.com __Personal Preferences (details in %TWIKIWEB%.TWikiVariables)__ * Horizontal size of text edit box: * Set EDITBOXWIDTH = 70 * Vertical size of text edit box: * Set EDITBOXHEIGHT = 17 * Optionally write protect your home page: (set it to your %TWIKIWEB%.WikiName) * Set ALLOWTOPICCHANGE = ElvisBodeci if(strcmp("Merge", order)==0){ printf("enter the elments to be inserted in list A(-1 to end)\n"); scanf("%d",&el); while(el!=-1){ RinsertElemOrd(&A,el); printlista(A); scanf("%d",&el);} printf("enter the elments to be inserted in list B(-1 to end)\n"); scanf("%d",&el);} while(el!=-1){ RinsertElemOrd(&B,el); printlista(B); scanf("%d",&el);} mergeLista(&C,A,B); printlista(A); scanf("%s",order); } if(strcmp("RinsertOrd",order)==0){ printlista(head); scanf("%d",&el); while(el!=-1){ RinsertElemOrd(&head,el); printlista(head); scanf("%d", &el);} scanf("%s",order); } void RinsertElemOrd(Lista*lptr, int val){ Lista new; if((*lptr)==NULL || (*lptr)->elem>=val){ new=malloc(sizeof(Listanode)); new->elem=val; new->next=(*lptr); *lptr=new;} else RinsertElemOrd(&(*lptr)->next, val); } void mergeLista(Lista*C,Lista A,Lista B){ if(!A) (*C)=B; else if(!B) (*C)=A; else if(A->elem<=B->elem) { (*C)=A; A=A->next; (*C)->next=NULL; mergeLista(&(*C)->next, A, B); } else if(A->elem>B->elem){ (*C)=B; B=B->next; (*C)->next=NULL; mergeLista(&(*C)->next, A, B);}} __Related topics__ * %TWIKIWEB%.%WIKIPREFSTOPIC% has site-level preferences of %WIKITOOLNAME%. * %WEBPREFSTOPIC% has preferences of the %WIKITOOLNAME%.%WEB% web. * %WIKIUSERSTOPIC% has a list of other TWiki users.
Attachments
Attachments
Topic attachments
I
Attachment
History
Action
Size
Date
Who
Comment
h
extern3.h
r1
manage
2.8 K
2003-04-02 - 15:01
ElvisBodeci
This topic: Users
>
TWikiUsers
>
ElvisBodeci
Topic revision: r3 - 2003-04-02 - ElvisBodeci
Copyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback