Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. TList list_insert_ordered(TList list, TInfo x){
  2.  
  3. TNode *curr = list;
  4. TNode *node;
  5. TNode *succ;
  6.  
  7. curr->link = succ;
  8.  
  9. while(curr!=NULL && greater(x,curr->info))
  10. {curr = curr->link;}
  11.  
  12. if(curr==NULL)
  13. {node = node_create(x);
  14. assert(node!=NULL);
  15. node->link == list;
  16. return node;}
  17. else{
  18. node = node_create(x);
  19. assert(node!=NULL);
  20. node->link = succ;
  21. curr->link = node;
  22. return list;}
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement