Advertisement
Mercedes

agregar ordenado

Jun 17th, 2014
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. void AgregarOrdenado (struct lista **L,int num){
  2. struct lista *act=(*L), *ant=(*L), *nue;
  3. Inicializar(&nue,num);
  4. while((act!=NULL) && (num>((act)->num))){
  5. ant=act;
  6. act=act->sig;
  7.  
  8.  
  9. }
  10.  
  11. if((*L) == act){
  12. nue->sig=(*L);
  13. (*L)=nue;
  14.  
  15.  
  16. }
  17.  
  18. else {
  19. nue->sig=ant->sig;
  20. ant->sig=nue;
  21.  
  22. }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement