Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // fprintf(stderr, "PQ_Insert Initialized\n");
- Node_ptr_t foo;
- Node_ptr_t nxt;
- // printf("priority = %d\n", priority);
- char *d = data;
- if(head==NULL){
- fprintf(stderr, "If activated\n");
- foo->priority = priority;
- // fprintf(stderr, "pri activated\n");
- foo->data=d;
- // fprintf(stderr, "d activated\n");
- foo->next = NULL;
- // fprintf(stderr, "head=null worked");
- head = foo;
- }else{
- Node_ptr_t new;
- Node_ptr_t prev;
- printf("head->priority = %d\n", head->priority);
- foo = head;
- do{
- prev = foo;
- if(foo->next != NULL)
- foo = foo->next;
- else
- break;
- }while(priority<foo->priority);
- printf("foo->priority = %d\n", foo->priority);
- printf("prev->priority = %d\n", prev->priority);
- prev->next = new;
- fprintf(stderr, "before activated\n");
- new->priority = priority;
- fprintf(stderr, "after activated\n");
- new->next = foo;
- /*
- new->priority = priority;
- new->data = data;
- prev->next = new;
- new->next = foo;
- */
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement