Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. // fprintf(stderr, "PQ_Insert Initialized\n");
  2. Node_ptr_t foo;
  3. Node_ptr_t nxt;
  4. // printf("priority = %d\n", priority);
  5. char *d = data;
  6. if(head==NULL){
  7. fprintf(stderr, "If activated\n");
  8. foo->priority = priority;
  9. // fprintf(stderr, "pri activated\n");
  10. foo->data=d;
  11. // fprintf(stderr, "d activated\n");
  12. foo->next = NULL;
  13. // fprintf(stderr, "head=null worked");
  14. head = foo;
  15. }else{
  16. Node_ptr_t new;
  17. Node_ptr_t prev;
  18. printf("head->priority = %d\n", head->priority);
  19. foo = head;
  20. do{
  21. prev = foo;
  22. if(foo->next != NULL)
  23. foo = foo->next;
  24. else
  25. break;
  26. }while(priority<foo->priority);
  27. printf("foo->priority = %d\n", foo->priority);
  28. printf("prev->priority = %d\n", prev->priority);
  29. prev->next = new;
  30. fprintf(stderr, "before activated\n");
  31. new->priority = priority;
  32. fprintf(stderr, "after activated\n");
  33. new->next = foo;
  34.  
  35. /*
  36. new->priority = priority;
  37. new->data = data;
  38. prev->next = new;
  39. new->next = foo;
  40. */
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement