C??????÷?????????????????
????????????????? ???????[ 2016/10/8 14:27:02 ] ??????????????????? .NET
?????????????????У??????????????????????????????????С???????????к?????????ī??????????????????????????????????????????????????????????????????????????——???????????????????С???????????????????????????????У?????????????С???????????????????????????????????洢???????????????????????????????????????????????????????????????????????????????????????????????????????????????У?????????????????β???????????????????????????????????????????????????β???в????????????????????????????в?????÷????????????????????β???????????????https://github.com/chenyufeng1991/Queue_LinkedList ??
??????????????£?
??????1???????????
????//????????????β???????????????
????void InitialQueue(Queue **pHead??Queue **pTail){
????*pHead = (Queue *)malloc(sizeof(Queue));
????*pTail = (Queue *)malloc(sizeof(Queue));
????if (*pHead == NULL || *pTail == NULL) {
????printf("%s??????У????????????????????????
"??__FUNCTION__);
????}else{
????//?????????????????п?????????
????(*pHead)->next = NULL;
????(*pTail)->prior = NULL;
????//?????????????????β?????????
????(*pHead)->prior = *pTail;
????(*pTail)->next = *pHead;
????printf("%s??????У????????β??????????????????????
"??__FUNCTION__);
????}
????}
??????2????????β?????????
????//??????????????β????????
????void EnQueue(Queue *head??Queue *tail??int x){
????Queue *pInsert;
????pInsert = (Queue *)malloc(sizeof(Queue));
????memset(pInsert?? 0?? sizeof(Queue));
????pInsert->next = NULL;
????pInsert->prior = NULL;
????pInsert->element = x;
????tail->next->prior = pInsert;
????pInsert->next = tail->next;
????tail->next = pInsert;
????pInsert->prior = tail;
????}
??????3???????????????????
????//???????????????????
????void DeQueue(Queue *head??Queue *tail){
????if (IsEmpty(head??tail)) {
????printf("?????????????????
");
????}else{
????Queue *pFreeNode;
????pFreeNode = head->prior;
????head->prior->prior->next = head;
????head->prior = head->prior->prior;
????free(pFreeNode);
????pFreeNode = NULL;
????}
????}
??????4????????н??
????//???????????????β???????????
????void PrintQueue(Queue *head??Queue *tail){
????Queue *pMove;
????pMove = head->prior;
????printf("????????е?????(????????):");
????while (pMove != tail) {
????printf("%d "??pMove->element);
????pMove = pMove->prior;
????}
????printf("
");
????}
??????5???ж??????????
????//?ж?????????????????1????????0
????int IsEmpty(Queue *head??Queue *tail){
????if (head->prior == tail) {
????return 1;
????}
????return 0;
????}
??????6?????????
????int main(int argc?? const char * argv[]) {
????Queue *pHead;//????
????Queue *pTail;//β???
????InitialQueue(&pHead?? &pTail);
????EnQueue(pHead?? pTail?? 2);EnQueue(pHead?? pTail?? 1);
????EnQueue(pHead?? pTail?? 9);EnQueue(pHead?? pTail?? 3);EnQueue(pHead?? pTail?? 4);
????PrintQueue(pHead?? pTail);
????DeQueue(pHead??pTail);DeQueue(pHead??pTail);DeQueue(pHead??pTail);
????PrintQueue(pHead?? pTail);
????return 0;
????}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11