Tags:
create new tag
view all tags
  • Name: Elvis Bodeci
  • Matricola: A219407109
  • Email: elvisbodeci@hotmail.com

Personal Preferences (details in 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 WikiName)

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

Topic attachments
I Attachment History Action Size Date Who Comment
Header fileh extern3.h r1 manage 2.8 K 2003-04-02 - 15:01 ElvisBodeci  
Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2003-04-02 - ElvisBodeci






 
Questo sito usa cookies, usandolo ne accettate la presenza. (CookiePolicy)
Torna al Dipartimento di Informatica
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback