最原始的办法:
1,用链表实现队列
2,队列的添加是从链表尾向前遍历
T* newNode;
T* tmp = (T*)tail;
while (tmp != NULL) {
if (newNode->pri > tmp->pri) {
tmp = tmp->prev;
continue;
}
else if (newNode->pri <= tmp->pri) {
newNode->next = tmp->next;
tmp->next->prev = newNode;
tmp->next = newNode;
newNode->prev = tmp;
}
}
3,取队列时从链表头开始取