Implementing ADT Priority Que as linked list, can't sort elements
问题 I am implementing Abstract Data Type - Priority que, but I can't find out how to put values in correct order. My structures: typedef int kintyr; typedef struct qElem { struct qElem *prv; kintyr *dat; int *priority; }qElem; typedef struct que { qElem *fr,*bk; int cnt; }que; And now my main functions to implement a Priority que First to create an empty PQ: que *qNew() { que *q = malloc(sizeof(*q)); if (q==NULL) return NULL; q->fr = NULL; q->bk = NULL; q->cnt = 0; qFault = 0; return q; } This is